summaryrefslogtreecommitdiff
path: root/src/BtSetup.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2011-10-30 13:07:48 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2011-10-30 13:07:48 +0900
commite9b86f2f4354dc147ce9d63fe3f576eb4f2a17dd (patch)
treed9f334c3bde48857e6d431faf93701d309cdffcf /src/BtSetup.cc
parentd1667ea246d492ab0280624cdcc6a454aff7ba0d (diff)
Use SegList<int> instead of IntSequence in PeerListenCommand::bindPort()
Diffstat (limited to 'src/BtSetup.cc')
-rw-r--r--src/BtSetup.cc15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/BtSetup.cc b/src/BtSetup.cc
index 36e57a9e..7ae588b4 100644
--- a/src/BtSetup.cc
+++ b/src/BtSetup.cc
@@ -53,7 +53,7 @@
#include "LogFactory.h"
#include "Logger.h"
#include "util.h"
-#include "IntSequence.h"
+#include "SegList.h"
#include "DHTGetPeersCommand.h"
#include "DHTPeerAnnounceStorage.h"
#include "DHTSetup.h"
@@ -193,12 +193,15 @@ void BtSetup::setup(std::vector<Command*>& commands,
bool ret;
uint16_t port;
if(btReg->getTcpPort()) {
- IntSequence seq = util::parseIntRange(util::uitos(btReg->getTcpPort()));
- ret = command->bindPort(port, seq);
+ SegList<int> sgl;
+ int usedPort = btReg->getTcpPort();
+ sgl.add(usedPort, usedPort+1);
+ ret = command->bindPort(port, sgl);
} else {
- IntSequence seq =
- util::parseIntRange(e->getOption()->get(PREF_LISTEN_PORT));
- ret = command->bindPort(port, seq);
+ SegList<int> sgl;
+ util::parseIntSegments(sgl, e->getOption()->get(PREF_LISTEN_PORT));
+ sgl.normalize();
+ ret = command->bindPort(port, sgl);
}
if(ret) {
btReg->setTcpPort(port);