projects
/
anytun.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Imported Upstream version 0.3.4
[anytun.git]
/
src
/
anyrtpproxy
/
portWindow.cpp
diff --git
a/src/anyrtpproxy/portWindow.cpp
b/src/anyrtpproxy/portWindow.cpp
index
3e07662
..
3ef1767
100644
(file)
--- a/
src/anyrtpproxy/portWindow.cpp
+++ b/
src/anyrtpproxy/portWindow.cpp
@@
-11,7
+11,7
@@
* tunneling and relaying of packets of any protocol.
*
*
* tunneling and relaying of packets of any protocol.
*
*
- * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl,
+ * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl,
* Christian Pointner <satp@wirdorange.org>
*
* This file is part of Anytun.
* Christian Pointner <satp@wirdorange.org>
*
* This file is part of Anytun.
@@
-32,7
+32,7
@@
#include "portWindow.h"
#include "portWindow.h"
-PortWindow::PortWindow(u
_int16_t start, u_
int16_t end) : start_port_(start), end_port_(end)
+PortWindow::PortWindow(u
int16_t start, u
int16_t end) : start_port_(start), end_port_(end)
{
}
{
}
@@
-46,37
+46,41
@@
PortWindow::PortSet::size_type PortWindow::getLength()
return ports_.size();
}
return ports_.size();
}
-bool PortWindow::hasPort(u
_
int16_t port)
+bool PortWindow::hasPort(uint16_t port)
{
Lock lock(mutex_);
PortSet::const_iterator it=ports_.find(port);
{
Lock lock(mutex_);
PortSet::const_iterator it=ports_.find(port);
- if(it == ports_.end())
+ if(it == ports_.end())
{
return false;
return false;
+ }
return true;
}
return true;
}
-bool PortWindow::freePort(u
_
int16_t port)
+bool PortWindow::freePort(uint16_t port)
{
Lock lock(mutex_);
PortSet::iterator it=ports_.find(port);
{
Lock lock(mutex_);
PortSet::iterator it=ports_.find(port);
- if(it == ports_.end())
+ if(it == ports_.end())
{
return false;
return false;
- ports_.erase(it);
+ }
+ ports_.erase(it);
return true;
}
return true;
}
-u
_
int16_t PortWindow::newPort()
+uint16_t PortWindow::newPort()
{
Lock lock(mutex_);
{
Lock lock(mutex_);
- u_int16_t port= start_port_;
- while (port<end_port_ && ports_.find(port) !=ports_.end())
- port++;
- if (port>=end_port_)
- return 0;
- ports_.insert(port);
- return port;
+ uint16_t port= start_port_;
+ while(port<end_port_ && ports_.find(port) !=ports_.end()) {
+ port++;
+ }
+ if(port>=end_port_) {
+ return 0;
+ }
+ ports_.insert(port);
+ return port;
}
void PortWindow::clear()
}
void PortWindow::clear()