From e46b1d36099f8792f88b77ee42730de2ecf93c26 Mon Sep 17 00:00:00 2001 From: haller Date: Sat, 9 Apr 2005 23:48:20 +0000 Subject: Corrections de deux bugs Ajout d'une constante timeout --- 2005/i/robert/src/proto/proto.cc | 6 +++--- 2005/i/robert/src/proto/proto.hh | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to '2005/i/robert/src') diff --git a/2005/i/robert/src/proto/proto.cc b/2005/i/robert/src/proto/proto.cc index b5e397f..3a35ec3 100644 --- a/2005/i/robert/src/proto/proto.cc +++ b/2005/i/robert/src/proto/proto.cc @@ -29,7 +29,7 @@ /// Constructeur. Proto::Proto(Receiver &receiver) - :receiver_(receiver), tLastSend_(-1000), revState_(0) + :receiver_(receiver), tLastSend_(0), revState_(0) { } @@ -76,7 +76,7 @@ Proto::sync(void) if(!frameQueue_.empty()) { //Si on dépasse la milliseconde, on renvoie - if(Timer::getProgramTime() - tLastSend_ > 500) + if(Timer::getProgramTime() - tLastSend_ >= timeout_) sendFrame(frameQueue_.front()); } return frameQueue_.empty(); @@ -89,7 +89,7 @@ Proto::send (const Frame & frame, bool fiable) if(fiable) { if(frameQueue_.empty()) - tLastSend_ =0; + tLastSend_ = -timeout_; frameQueue_.push(frame); } else diff --git a/2005/i/robert/src/proto/proto.hh b/2005/i/robert/src/proto/proto.hh index c8d0211..5753fe0 100644 --- a/2005/i/robert/src/proto/proto.hh +++ b/2005/i/robert/src/proto/proto.hh @@ -49,7 +49,10 @@ class Proto : public NonCopyable /// File d'attente des messages à aquiter. typedef std::queue FrameQueue; FrameQueue frameQueue_; - int tLastSend_; //Date du dernier envoie + //Date du dernier envoie + int tLastSend_; + //Temps entre les ré-émission + static const int timeout_ = 100; /// Frame en cours de réception Frame currentFrame_; -- cgit v1.2.3