summaryrefslogtreecommitdiff
path: root/seqWindow.cpp
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anytun.org>2007-06-22 16:49:55 +0000
committerChristian Pointner <equinox@anytun.org>2007-06-22 16:49:55 +0000
commit7ca7a28a058b6644913f6e50eb944d657246ada0 (patch)
tree92ff77371cbcc98a0aa1149700f4d17f10b026fb /seqWindow.cpp
parentbroken makefile fixed (diff)
seqWindow test
Diffstat (limited to 'seqWindow.cpp')
-rw-r--r--seqWindow.cpp30
1 files changed, 24 insertions, 6 deletions
diff --git a/seqWindow.cpp b/seqWindow.cpp
index 2179762..9736f53 100644
--- a/seqWindow.cpp
+++ b/seqWindow.cpp
@@ -39,30 +39,48 @@ SeqWindow::SeqWindow(window_size_t w) : window_size_(w)
SeqWindow::~SeqWindow()
{
-
}
-SeqWindow::SeqQueue::size_type SeqWindow::getLength(sender_id_t sender)
+SeqWindow::SeqDeque::size_type SeqWindow::getLength(sender_id_t sender)
{
- return 0;
+ Lock lock(mutex_);
+ SenderMap::const_iterator s = sender_.find(sender);
+ if(s == sender_.end())
+ return 0;
+
+ return s->second.size();
}
bool SeqWindow::hasSeqNr(sender_id_t sender, seq_nr_t seq)
{
+ Lock lock(mutex_);
+ SenderMap::const_iterator s = sender_.find(sender);
+ if(s == sender_.end())
+ return false;
+
+ SeqDeque::const_iterator it;
+ for(it = s->second.begin(); it != s->second.end(); it++)
+ if(*it == seq)
+ return true;
+
return false;
}
void SeqWindow::addSeqNr(sender_id_t sender, seq_nr_t seq)
{
-
+ Lock lock(mutex_);
+ sender_[sender].push_back(seq);
}
void SeqWindow::clear(sender_id_t sender)
{
-
+ Lock lock(mutex_);
+ sender_[sender].clear();
+ sender_.erase(sender);
}
void SeqWindow::clear()
{
-
+ Lock lock(mutex_);
+ sender_.clear();
}