2009-10-31 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

Fixed the bug that when downloading more than one torrent,
	listening port is not reported properly to tracker for 2nd or
	later torrents.
	* src/BtSetup.cc
	* src/PeerListenCommand.cc
	* src/PeerListenCommand.h
	* src/RequestGroup.cc
pull/1/head
Tatsuhiro Tsujikawa 2009-10-31 08:47:19 +00:00
parent b63cd3a82a
commit a71b642db1
5 changed files with 27 additions and 1 deletions

View File

@ -1,3 +1,13 @@
2009-10-31 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Fixed the bug that when downloading more than one torrent,
listening port is not reported properly to tracker for 2nd or
later torrents.
* src/BtSetup.cc
* src/PeerListenCommand.cc
* src/PeerListenCommand.h
* src/RequestGroup.cc
2009-10-29 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Bump up version number to 1.6.3

View File

@ -158,6 +158,9 @@ void BtSetup::setup(std::deque<Command*>& commands,
_logger->error(_("Errors occurred while binding port.\n"));
delete listenCommand;
}
} else {
PeerListenCommand* listenCommand = PeerListenCommand::getInstance(e);
btRuntime->setListenPort(listenCommand->getPort());
}
time_t btStopTimeout = option->getAsInt(PREF_BT_STOP_TIMEOUT);
if(btStopTimeout > 0) {

View File

@ -96,6 +96,17 @@ bool PeerListenCommand::bindPort(uint16_t& port, IntSequence& seq)
return false;
}
uint16_t PeerListenCommand::getPort() const
{
if(socket.isNull()) {
return 0;
} else {
std::pair<std::string, uint16_t> addr;
socket->getAddrInfo(addr);
return addr.second;
}
}
bool PeerListenCommand::execute() {
if(e->isHaltRequested() || e->_requestGroupMan->downloadFinished()) {
return true;

View File

@ -67,6 +67,9 @@ public:
*/
bool bindPort(uint16_t& port, IntSequence& seq);
// Returns binded port
uint16_t getPort() const;
void setLowestSpeedLimit(unsigned int speed)
{
_lowestSpeedLimit = speed;

View File

@ -233,7 +233,6 @@ void RequestGroup::createInitialCommand(std::deque<Command*>& commands,
_option.get()));
BtRuntimeHandle btRuntime(new BtRuntime());
btRuntime->setListenPort(_option->getAsInt(PREF_LISTEN_PORT));
btRuntime->setMaxPeers(_option->getAsInt(PREF_BT_MAX_PEERS));
_btRuntime = btRuntime;
progressInfoFile->setBtRuntime(btRuntime);