Commit Graph

12 Commits

Author SHA1 Message Date
Tatsuhiro Tsujikawa
e6e0177560 * src/PeerInteractionCommand.cc (checkInactiveConnection): New
function
	(detectMessageFlooding): Updated.
	(checkLongTimePeerChoking): Updated.
	(getNewPieceAndSendInterest): Added debug log.
	* src/PeerInteractionCommand.h: New function 
checkInactiveConnection()
	
	* src/TorrentMan.cc (deleteOldErrorPeers): Updated.
	(getPeer): Updated.
	* src/TorrentMan.h: Added MAX_PEER_ERROR.
	
	* src/PeerAbstractCommand.cc (onAbort): Increment error counter.

	* src/PeerListenCommand.cc (execute): Close connection if 
incoming peer
	is localhost.

	* src/main.cc (main): Updated PREF_PEER_CONNECTION_TIMEOUT to 
60.

	* src/PendingMessage.cc (processMessage): Not to send piece 
message
	if peer is not interested in the pieces localhost has.

	* src/Peer.cc (shouldChoke): Updated.

	* src/SendMessageQueue.cc (cancelAllRequest): Fixed.
2006-03-31 13:58:22 +00:00
Tatsuhiro Tsujikawa
e1f24adc40 Added new class SendMessageQueue that includes PendingMessages
and
	RequestSlotMan.

	* src/SendMessageQueue.h: New class.
	* src/SendMessageQueue.cc: New class.
	* src/PendingMessage.h: Added new member variable blockIndex and 
its
	accessors.
	(createRequestMessage): Updated.
	* src/PendingMessage.cc (createRequestMessage): Updated.
	* src/PeerInteractionCommand.cc (executeInternal): Updated with
	SendMessageQueue.
	(checkLongTimePeerChoking): Updated with SendMessageQueue.
	(receiveMessage): Updated with SendMessageQueue.
	(deletePendingPieceMessage): Removed.
	(getNewPieceAndSendInterest): Updated with SendMessageQueue.
	(sendInterest): Updated with SendMessageQueue.
	(createRequestPendingMessage): Updated with SendMessageQueue.
	(sendMessages): Updated with SendMessageQueue.
	(onAbort): Updated with SendMessageQueue.
	(keepAlive): Updated with SendMessageQueue.
	(beforeSocketCheck): Updated SendMessageQueue.

	* src/PeerInteractionCommand (sendMessages): Shuffle
	missingBLockIndexes before using it.
	
	Added its own timeout for peer connection.
	
	* src/PeerAbstractCommand.h: Added member variable timeout and 
its
	setter.
	* src/prefs.h: Added PREF_PEER_CONNECTION_TIMEOUT.
	* src/PeerInteractionCommand.cc (PeerInteractionCommand):
	Added setTimeout() call.
	(executeInternal): Added setTimeout() call.
	* src/PeerAbstractCommand.cc (PeerAbstractCommand):
	Added timeout.
	(isTimeoutDetected): Updated.
	* src/main.cc (main): Added PREF_PEER_CONNECTION_TIMEOUT entry 
to
	option.
	
	Added *simple* message flooding checker.
	
	* src/PeerInteractionCommand.cc (executeInternal):
	Added detectMessageFlooding() call.
	(detectMessageFlooding): New function.
	(receiveMessage): Count up CHOKE, UNCHOKE, HAVE message.
	(beforeSocketCheck): Added detectMessageFlooding() call.
	* src/PeerInteractionCommand.h: Added sendMessageQueue,
	chokeUnchokeCount, haveCount, detectMessageFlooding().
	Removed deletePendingPieceMessage(), getRequestSlot(),
	deleteRequestSlot(), deleteAllRequestSlot().
	
	* src/PeerInteractionCommand.cc (beforeSocketCheck):
	Added checkLongTimePeerChoking() call.

	* src/RequestSlotMan.h: Renamed deleteTimeoutRequestSlot().

	* src/TorrentMan.cc (addPeer): Delete at most MAX_PEER_LIST_SIZE 
peers
	if duplicate == false.

	The parameter "uploaded" and "downloaded" in the tracker request 
are
	the size since the client sent the "started" event to the 
tracker.
	
	* src/TorrentMan.cc (setup): Assigned saved downloaded Size and
	uploaded size to preDownloadedSize, preUploadedSize 
respectively.
	* src/TorrentMan.h: Added preDownloadedSize, preUploadedSize,
	getSessionDownloadedSize(), getSessionUploadedSize().
	* src/TrackerInitCommand.cc (execute): Use 
getSessionDownloadedSize(),
	getSessionUploadedSize() instead of getDownloadedSize(),
	getUploadedSize().
	
	* src/PendingMessage.cc (processMessage): Do not send request 
message
	if the peer is choking the client.

	* src/TrackerUpdateCommand.cc (execute): Check wtheher 
minInterval is
	less than interval.
2006-03-28 15:23:51 +00:00
Tatsuhiro Tsujikawa
df6c7c0385 added bittorrent support(experimental) 2006-03-21 14:12:51 +00:00
Tatsuhiro Tsujikawa
2462a3b06c 2006-02-22 14:30:47 +00:00
Tatsuhiro Tsujikawa
27d392d5f2 2006-02-22 12:16:10 +00:00
Tatsuhiro Tsujikawa
ebdb4b86cf 2006-02-22 11:18:47 +00:00
Tatsuhiro Tsujikawa
28fc3405dd 2006-02-21 15:01:05 +00:00
Tatsuhiro Tsujikawa
8b1c7b0967 2006-02-18 05:21:43 +00:00
Tatsuhiro Tsujikawa
5752a554bf * Added Referer support.
* Added referer command-line option.
	* Added rety-wait command-line option.
	* Fixed formating bug in Exception::setMsg()
2006-02-18 05:13:21 +00:00
Tatsuhiro Tsujikawa
62d3659410 Added Referer support 2006-02-18 03:59:26 +00:00
Tatsuhiro Tsujikawa
2c732211f4 * Added HTTPS support.
* Added SocketCore. Socket is now handle class for SocketCore.
	* Fixed bug in ChunkedEncoding: expanding buffer size is wrong
	* Fixed bug in DownloadCommand: In Chunked Encoding, it wrongly
	adds to Segment.ds buff length from the socket.
2006-02-17 18:51:12 +00:00
Tatsuhiro Tsujikawa
52634627bc Initial import 2006-02-17 13:35:04 +00:00