2006-06-25 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

To fix the bug that causes same have message is sent many times 
to
	a single peer.

	* src/Time.cc
	(isNewer): Use Util::difftv().

	To fix the bug that sends tracker requests without a sleep 
interval
	when the number of connections is less than 15.

	* src/TrackerWatcherCommand.cc
	(execute): Now the number of connections is not a factor to 
decide
	whether or not a tracker request should be sent or not.
	* src/Time.h
	(setTimeInSec): New function.
	* src/Time.cc
	(setTimeInSec): New function.

	etc.
	
	* src/ChokeMessage.cc
	(receivedAction): Removed peer->snubbing = false

	* src/PeerConnection.h
	(receiveHandshake): Updated doc.

	* src/TorrentMan.h
	(getAdvertisedPieceIndexes): Updated the method signature.
	* src/TorrentMan.cc
	(getAdvertisedPieceIndexes): Updated the method signature.

	* Release 0.5.2
pull/1/head
Tatsuhiro Tsujikawa 2006-06-24 16:09:14 +00:00
parent d02d80d9e9
commit 722b3f8957
11 changed files with 67 additions and 19 deletions

View File

@ -1,3 +1,37 @@
2006-06-25 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
To fix the bug that causes same have message is sent many times to
a single peer.
* src/Time.cc
(isNewer): Use Util::difftv().
To fix the bug that sends tracker requests without a sleep interval
when the number of connections is less than 15.
* src/TrackerWatcherCommand.cc
(execute): Now the number of connections is not a factor to decide
whether or not a tracker request should be sent or not.
* src/Time.h
(setTimeInSec): New function.
* src/Time.cc
(setTimeInSec): New function.
etc.
* src/ChokeMessage.cc
(receivedAction): Removed peer->snubbing = false
* src/PeerConnection.h
(receiveHandshake): Updated doc.
* src/TorrentMan.h
(getAdvertisedPieceIndexes): Updated the method signature.
* src/TorrentMan.cc
(getAdvertisedPieceIndexes): Updated the method signature.
* Release 0.5.2
2006-06-22 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
To make a listening socket non-block:

20
configure vendored
View File

@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.59 for aria2c 0.5.1.
# Generated by GNU Autoconf 2.59 for aria2c 0.5.2.
#
# Report bugs to <tujikawa@rednoah.com>.
#
@ -269,8 +269,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='aria2c'
PACKAGE_TARNAME='aria2c'
PACKAGE_VERSION='0.5.1'
PACKAGE_STRING='aria2c 0.5.1'
PACKAGE_VERSION='0.5.2'
PACKAGE_STRING='aria2c 0.5.2'
PACKAGE_BUGREPORT='tujikawa@rednoah.com'
ac_unique_file="src/Socket.h"
@ -788,7 +788,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures aria2c 0.5.1 to adapt to many kinds of systems.
\`configure' configures aria2c 0.5.2 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -854,7 +854,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of aria2c 0.5.1:";;
short | recursive ) echo "Configuration of aria2c 0.5.2:";;
esac
cat <<\_ACEOF
@ -994,7 +994,7 @@ fi
test -n "$ac_init_help" && exit 0
if $ac_init_version; then
cat <<\_ACEOF
aria2c configure 0.5.1
aria2c configure 0.5.2
generated by GNU Autoconf 2.59
Copyright (C) 2003 Free Software Foundation, Inc.
@ -1008,7 +1008,7 @@ cat >&5 <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by aria2c $as_me 0.5.1, which was
It was created by aria2c $as_me 0.5.2, which was
generated by GNU Autoconf 2.59. Invocation command line was
$ $0 $@
@ -1651,7 +1651,7 @@ fi
# Define the identity of the package.
PACKAGE='aria2c'
VERSION='0.5.1'
VERSION='0.5.2'
cat >>confdefs.h <<_ACEOF
@ -11528,7 +11528,7 @@ _ASBOX
} >&5
cat >&5 <<_CSEOF
This file was extended by aria2c $as_me 0.5.1, which was
This file was extended by aria2c $as_me 0.5.2, which was
generated by GNU Autoconf 2.59. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -11591,7 +11591,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
aria2c config.status 0.5.1
aria2c config.status 0.5.2
configured by $0, generated by GNU Autoconf 2.59,
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"

View File

@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
#
AC_PREREQ(2.59)
AC_INIT(aria2c, 0.5.1, tujikawa@rednoah.com)
AC_INIT(aria2c, 0.5.2, tujikawa@rednoah.com)
AM_INIT_AUTOMAKE()
AM_PATH_CPPUNIT(1.10.2)
AC_CONFIG_SRCDIR([src/Socket.h])

View File

@ -9,7 +9,7 @@
# General Public License and is *not* in the public domain.
PACKAGE = aria2c
VERSION = 0.5.1
VERSION = 0.5.2
SHELL = /bin/sh

View File

@ -40,7 +40,6 @@ ChokeMessage* ChokeMessage::create(const char* data, int dataLength) {
void ChokeMessage::receivedAction() {
peer->peerChoking = true;
peer->snubbing = false;
peerInteraction->onChoked();
}

View File

@ -55,6 +55,12 @@ public:
int sendMessage(const char* msg, int length);
bool receiveMessage(char* msg, int& length);
/**
* Returns true if a handshake message is fully received, otherwise returns
* false.
* In both cases, 'msg' is filled with received bytes and the filled length
* is assigned to 'length'.
*/
bool receiveHandshake(char* msg, int& length);
};

View File

@ -58,7 +58,7 @@ bool Time::elapsedInMillis(int millis) const {
}
bool Time::isNewer(const Time& time) const {
return Util::difftvsec(this->tv, time.tv) > 0;
return Util::difftv(this->tv, time.tv) > 0;
}
int Time::difference() const {
@ -68,3 +68,8 @@ int Time::difference() const {
long long int Time::differenceInMillis() const {
return Util::difftv(getCurrentTime(), tv)/1000;
}
void Time::setTimeInSec(int sec) {
tv.tv_sec = sec;
tv.tv_usec = 0;
}

View File

@ -65,6 +65,8 @@ public:
return tv.tv_sec;
}
void setTimeInSec(int sec);
bool isNewer(const Time& time) const;
};

View File

@ -655,7 +655,7 @@ void TorrentMan::advertisePiece(int cuid, int index) {
};
PieceIndexes TorrentMan::getAdvertisedPieceIndexes(int myCuid,
Time lastCheckTime) const {
const Time& lastCheckTime) const {
PieceIndexes indexes;
for(Haves::const_iterator itr = haves.begin(); itr != haves.end(); itr++) {
const Haves::value_type& have = *itr;

View File

@ -178,7 +178,7 @@ public:
void advertisePiece(int cuid, int index);
PieceIndexes getAdvertisedPieceIndexes(int myCuid, Time lastCheckTime) const;
PieceIndexes getAdvertisedPieceIndexes(int myCuid, const Time& lastCheckTime) const;
long long int getTotalLength() const { return totalLength; }
void setTotalLength(long long int length) { totalLength = length; }

View File

@ -28,7 +28,10 @@
TrackerWatcherCommand::TrackerWatcherCommand(int cuid,
TorrentDownloadEngine* e,
int interval):
Command(cuid), e(e), interval(interval) {}
Command(cuid), e(e), interval(interval) {
// to force requesting to a tracker first time.
checkPoint.setTimeInSec(0);
}
TrackerWatcherCommand::~TrackerWatcherCommand() {}
@ -44,8 +47,7 @@ bool TrackerWatcherCommand::execute() {
return false;
}
if(e->torrentMan->trackers == 0 &&
(e->torrentMan->connections < MAX_PEER_UPDATE ||
e->torrentMan->isHalt() ||
(e->torrentMan->isHalt() ||
checkPoint.elapsed(interval))) {
checkPoint.reset();
e->torrentMan->req->resetTryCount();