ChangeLog 88 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486
  1. 2006-07-04 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2. To improve the conditional compilation:
  3. * src/MultiDiskWriter.h:
  4. Replaced ENABLE_SHA1DIGEST with ENABLE_MESSAGE_DIGEST.
  5. * src/MultiDiskWriter.cc:
  6. Replaced ENABLE_SHA1DIGEST with ENABLE_MESSAGE_DIGEST.
  7. * src/Util.h:
  8. Replaced ENABLE_SHA1DIGEST with ENABLE_MESSAGE_DIGEST.
  9. Added ENABLE_BITTORRENT around computeFastSet().
  10. * src/Util.cc:
  11. Replaced ENABLE_SHA1DIGEST with ENABLE_MESSAGE_DIGEST.
  12. Added ENABLE_BITTORRENT around computeFastSet().
  13. * src/messageDigest.h:
  14. Replaced ENABLE_BITTORRENT with ENABLE_SSL.
  15. * src/ShaVisitor.h:
  16. Replaced ENABLE_SHA1DIGEST with ENABLE_MESSAGE_DIGEST.
  17. * src/ShaVisitor.cc:
  18. Replaced ENABLE_SHA1DIGEST with ENABLE_MESSAGE_DIGEST.
  19. * src/main.cc:
  20. Added ENABLE_BITTORRENT around includes and blocks related to
  21. BitTorrent.
  22. Added ENABLE_MESSAGE_DIGEST to skip checksum checking when the message
  23. digest support is not available.
  24. * src/AbstractDiskWriter.h:
  25. Replaced ENABLE_SHA1DIGEST with ENABLE_MESSAGE_DIGEST.
  26. * src/AbstractDiskWriter.cc:
  27. Replaced ENABLE_SHA1DIGEST with ENABLE_MESSAGE_DIGEST.
  28. * src/MetalinkEntry.cc
  29. (check): Added ENABLE_MESSAGE_DIGEST. Return true if the message digest
  30. support is not available.
  31. To add command-line options for Metalink:
  32. * src/main.cc:
  33. Added metalink-version, metalink-language, metalink-os,
  34. follow-metalink.
  35. To use EXIT_SUCCESS and EXIT_FAILURE with exit():
  36. * src/main.cc: Use these definition.
  37. 2006-07-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  38. To add Metalink support(http/ftp only):
  39. * src/AbstractCommand.h
  40. (tryReserved): New function.
  41. * src/AbstractCommand.cc
  42. (execute): Call tryReserved().
  43. (tryReserved): New function.
  44. * src/Request.h
  45. (Requests): New type definition.
  46. * src/SegmentMan.h
  47. (reserved): New variable.
  48. * src/Util.h
  49. (fileChecksum): New function.
  50. (toUpper): New function.
  51. (toLower): New function.
  52. * src/Util.cc
  53. (messageDigest.h): Included.
  54. (trim): Trim \r\n\t.
  55. (fileChecksum): New function.
  56. (toUpper): New function.
  57. (toLower): New function.
  58. * src/main.cc
  59. (normalDownload): New function.
  60. (main): Added 2 command-line options: metalink-file,
  61. metalink-connection. Their usage has not been written yet.
  62. * src/MetalinkProcessor.h: New class.
  63. * src/Xml2MetalinkProcessor.h: New class.
  64. * src/Xml2MetalinkProcessor.cc: New class.
  65. * src/MetalinkEntry.h: New class.
  66. * src/MetalinkEntry.cc: New class.
  67. * src/MetalinkResource.h: New class.
  68. * src/MetalinkResource.cc: New class.
  69. To add md5 message digest checking:
  70. * src/messageDigest.h: Rewritten.
  71. * src/MultiDiskWriter.cc: Updated according to the changes in
  72. messageDigest.h.
  73. * src/ShaVisitor.cc: Updated according to the changes in
  74. messageDigest.h.
  75. * src/Util.cc: Updated according to the changes in messageDigest.h.
  76. * src/AbstractDiskWriter.cc: Updated according to the changes in
  77. messageDigest.h.
  78. To fix a bug that causes segfault when the payload length in peer
  79. message is less than 0:
  80. * src/PeerConnection.cc:
  81. (receiveMessage): Fixed the bug.
  82. * src/PeerMessageUtil.cc
  83. (checkLength): Throw an exception if length is less than or equals to
  84. 0.
  85. To add new interfaces to Base64 encoding/decoding:
  86. * src/Base64.h
  87. (part_encode): Changed the method signature.
  88. (encode): New function(overload).
  89. (decode): New function(overload).
  90. * src/Base64.cc
  91. (part_encode): Rewritten.
  92. (encode): Rewritten.
  93. (encode): New function(overload).
  94. To prevent a peer to download same piece if there is an error in
  95. checksum:
  96. * src/PieceMessage.cc
  97. (receivedAction): Call peerInteraction->abortPiece().
  98. 2006-06-25 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  99. To fix the bug that causes same have message is sent many times to
  100. a single peer.
  101. * src/Time.cc
  102. (isNewer): Use Util::difftv().
  103. * src/Util.cc
  104. (difftv): Added a cast to (long long int).
  105. * src/TorrentMan.cc
  106. (advertisePiece): Use push_front.
  107. (getAdvertisedPieceIndexes): A performance improvement was made.
  108. To fix the bug that sends tracker requests without a sleep interval
  109. when the number of connections is less than 15.
  110. * src/TrackerWatcherCommand.cc
  111. (execute): Now the number of connections is not a factor to decide
  112. whether or not a tracker request should be sent or not.
  113. * src/Time.h
  114. (setTimeInSec): New function.
  115. * src/Time.cc
  116. (setTimeInSec): New function.
  117. etc.
  118. * src/ChokeMessage.cc
  119. (receivedAction): Removed peer->snubbing = false
  120. * src/PeerConnection.h
  121. (receiveHandshake): Updated doc.
  122. * src/TorrentMan.h
  123. (getAdvertisedPieceIndexes): Updated the method signature.
  124. * src/TorrentMan.cc
  125. (getAdvertisedPieceIndexes): Updated the method signature.
  126. * src/Time.h
  127. (getTimeInMicros): Added a cast to (long long int).
  128. (getTimeInMillis): Added a cast to (long long int).
  129. * Release 0.5.2
  130. 2006-06-22 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  131. To make a listening socket non-block:
  132. * src/SocketCore.h
  133. (setNonBlockingMode): New function.
  134. * src/SocketCore.cc
  135. (setNonBlockingMode): New function.
  136. (beginListen): Added a call to setNonBlockingMode().
  137. (acceptConnection): Call setNonBlockingMode().
  138. (setBlockingMode): Updated.
  139. To handle tracker's NAT-checking:
  140. * src/PeerConnection.cc
  141. (receiveHandshake): 'msg' param is filled with received data and
  142. its length is assigned to 'length' param, even if all handshake
  143. message is not yet received.
  144. * src/PeerInteractionCommand.cc
  145. (executeInternal): Use peerInteraction->receiveHandshake(true) when
  146. a new peer connects to localhost.
  147. A call to peerInteraction->sendHandshake() was removed because
  148. it is called from peerInteraction->receiveHandshake(true).
  149. * src/PeerInteraction.h
  150. (quickReplied): New variable.
  151. (receiveHandshake): Added an argument.
  152. * src/PeerInteraction.cc
  153. (PeerInteraction): Added the initialization of quickReplied.
  154. (receiveHandshake): Send handshake message as soon as the info hash
  155. in a handshake message from a peer is correct.
  156. To change the random part of peer id and key parameter:
  157. * src/TorrentMan.h
  158. (key): New variable.
  159. * src/TorrentMan.cc
  160. (setupInternal1): Use Util::randomAlpha() to generate random part
  161. of peer id, which is now "-aria2-"+13 alphabet characters([A-Za-z]).
  162. key is also generated by Util::randomAlpha() and it is now 8 character
  163. long.
  164. * src/Util.h
  165. (randomAlpha): New function.
  166. * src/Util.cc
  167. (randomAlpha): New function.
  168. * src/TrackerWatcherCommand.cc
  169. (execute): In a tracker request: Use torrentMan->key as key parameter.
  170. Added no_peer_id=1.
  171. Set snubbing flag to false when a choke message is received from a
  172. snubbed peer.
  173. * src/ChokeMessage.cc
  174. (receivedAction): Set snubbing flag to false.
  175. 2006-06-18 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  176. * src/TorrentMan.cc (setupInternal1): Fixed peerId generation bug.
  177. * src/SimpleLogger.h (writeHeader): New function.
  178. * src/SimpleLogger.cc (writeHeader): New function.
  179. (writeLog): Fixed the bug that causes segfaults if exception message
  180. contains an unescaped "%" character.
  181. * src/TrackerWatcherCommand.cc (execute): Added a short sleep
  182. when a tracker request fails.
  183. * src/Request.cc (parseUrl): Query string is now handled properly.
  184. * Release 0.5.1
  185. 2006-06-12 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  186. To add Time class which represents a specific instant in time and
  187. its precision is microseconds. Time checking procedures were rewritten
  188. using this object.
  189. * src/Time.h: New class.
  190. * src/Time.cc: New class.
  191. * src/AbstractCommand.h
  192. (updateCheckPoint): Removed.
  193. (isTimeoutDetected): Removed.
  194. (checkPoint): Changed the type to Time.
  195. (timeout): New variable.
  196. (setTimeout): New function.
  197. * src/AbstractCommand.cc
  198. (AbstractCommand): Removed the initialization of checkPoint.
  199. Added the initialization of timeout.
  200. (updateCheckPoint): Removed.
  201. (isTimeoutDetected): Removed.
  202. (execute): Use checkPoint.reset() and checkPoint.elapsed().
  203. * src/PeerChokeCommand.h
  204. (checkPoint): Changed the type to Time.
  205. * src/PeerChokeCommand.cc
  206. (PeerChokeCommand): Removed the initialization of checkPoint.
  207. (execute): Rewritten using Time object.
  208. * src/TrackerWatcherCommand.h
  209. (checkPoint): Changed the type to Time.
  210. * src/TrackerWatcherCommand.cc
  211. (TrackerWatcherCommand): Removed the initialization of checkPoint.
  212. (execute): Rewritten.
  213. * src/ConsoleDownloadEngine.h
  214. (cp): Changed the type to Time.
  215. (startup): Changed the type to Time.
  216. * src/ConsoleDownloadEngine.cc
  217. (initStatistics): Use cp.reset(), startup.reset().
  218. (calculateStatistics): Rewritten using Time object.
  219. * src/PeerAbstractCommand.h
  220. (updateCheckPoint): Removed.
  221. (isTimeoutDetected): Removed.
  222. (checkPoint): Changed the type to Time.
  223. * src/PeerAbstractCommand.cc
  224. (PeerAbstractCommand): Removed the initialization of checkPoint.
  225. (updateCheckPoint): Removed.
  226. (isTimeoutDetected): Removed.
  227. (execute): Use checkPoint.reset() and checkPoint.elapsed().
  228. * src/PeerInteractionCommand.cc
  229. (PeerInteractionCommand): Removed the initializations of struct
  230. timeval variables.
  231. * src/PeerInteractionCommand.h
  232. (keepAliveCheckPoint): Changed the type to Time.
  233. (chokeCheckPoint): Changed the type to Time.
  234. (freqCheckPoint): Changed the type to Time.
  235. (haveCheckTime): Changed the type to Time.
  236. * src/PeerInteractionCommand.cc
  237. (executeInternal): Rewritten using Time object.
  238. (detectMessageFlooding): Rewritten using Time object.
  239. (checkLongTimePeerChoking): Rewritten using Time object.
  240. (sendKeepAlive): Rewritten using Time object.
  241. (checkHave): Rewritten using Time object.
  242. * src/SleepCommand.h
  243. (checkPoint): Changed the type to Time.
  244. * src/SleepCommand.cc
  245. (SleepCommand): Removed the initialization of checkPoint.
  246. (execute): Rewritten using Time object.
  247. * src/TorrentAutoSaveCommand.h
  248. (checkPoint): Changed the type to Time.
  249. * src/TorrentAutoSaveCommand.cc
  250. (TorrentAutoSaveCommand): Removed the initialization of checkPoint.
  251. (execute): Rewritten.
  252. * src/DownloadCommand.h
  253. (sw): Changed the type to Time.
  254. * src/DownloadCommand.cc
  255. (DownloadCommand): Removed the initialization of sw.
  256. (executeInternal): Rewritten.
  257. * src/RequestSlot.h
  258. (dispatchedTime): Changed the type to Time.
  259. * src/RequestSlot.cc
  260. (RequestSlot): Removed the call to setDispatchedTime().
  261. (setDispatchedTime): Rewirtten.
  262. (isTimeout): Rewritten.
  263. (getLatencyInMillis): Rewritten.
  264. * src/TorrentDownloadEngine.h
  265. (cp): Changed the type to Time[2].
  266. (startup): Changed the type to Time.
  267. * src/TorrentDownloadEngine.cc
  268. (initStatistics): Rewritten.
  269. (calculateStatistics): Rewritten.
  270. * src/DownloadEngine.cc
  271. (run): Rewritten.
  272. To detect all attempts to connect to the tracker are failed:
  273. * src/AbstractCommand.cc
  274. (execute): Increment e->segmentMan->errors if a command aborted.
  275. * src/SegmentMan.h
  276. (errors): New variable.
  277. * src/SegmentMan.cc
  278. (SegmentMan): Added the initialization of errors.
  279. (init): Added the initialization of errors.
  280. * src/TrackerWatcherCommand.cc
  281. (execute): If e->segmentMan->errors > 0 then assume that the tracker
  282. request was failed.
  283. To handle snubbed peers:
  284. * src/PeerChokeCommand.cc
  285. (optUnchokingPeer): Snubbed peers don't get unchoked.
  286. (execute): Snubbed peers don't get unchoked.
  287. * src/PeerInteraction.h
  288. (REQUEST_TIME_OUT): Changed the value from 120 to 60.
  289. * src/PeerInteraction.cc
  290. (checkRequestSlot): A peer get marked as "snubbed" if it doesn't send
  291. back the requested 16k block in 60 seconds.
  292. * src/PieceMessage.cc
  293. (receivedAction): A peer's snubbed state is cleard if it sends
  294. the requested 16k block in 60 seconds.
  295. * src/Peer.h
  296. (snubbing): New variable.
  297. * src/Peer.cc
  298. (resetStatus): Added snubbed = false.
  299. To fix the bug that causes have message is not sent:
  300. * src/PeerInteractionCommand.cc
  301. (~PeerInteractionCommand): Removed e->torrentMan->unadvertisePiece().
  302. (FLOODING_CHECK_INTERVAL): New definition(temporal).
  303. (detectMessageFlooding): Use FLOODING_CHECK_INTERVAL.
  304. * src/TorrentMan.h
  305. (HaveEntry): New class.
  306. (advertisePiece): Rewritten.
  307. (getAdvertisedPieceIndexes): Rewritten.
  308. (Haves): Changed the type.
  309. (getAdvertisedPieceIndexes): Added an argument.
  310. Others:
  311. * src/TorrentMan.h
  312. (DEFAULT_ANNOUNCE_INTERVAL): Changed the value to 1800.
  313. (DEFAULT_ANNOUNCE_MIN_INTERVAL): Changed the value to 1800.
  314. * src/TorrentMan.cc
  315. (getPeer): Don't check the number of connections here.
  316. (setupInternal1): Changed peerId.
  317. * src/PeerInteractionCommand.h
  318. (KEEP_ALIVE_INTERVAL): New definition.
  319. (sendKeepAlive): Use KEEP_ALIVE_INTERVAL.
  320. * src/main.cc
  321. (main): SA_ONESHOT was replaced with SA_RESETHAND.
  322. * src/DownloadEngine.h: Removed unnecessary header includes.
  323. 2006-05-29 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  324. To fix the bug that causes segfaults if a tracker returns a zero-length
  325. list as "peers":
  326. * src/TrackerUpdateCommand.cc
  327. (execute): Added a check to see wether the type of peers is Data*.
  328. 2006-05-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  329. * Release 0.5.0
  330. To fix compile issue with gcc3:
  331. * src/CancelMessage.h
  332. (ID): Renamed as ID_t
  333. (ID_t): New enum.
  334. * src/RejectMessage.h
  335. (ID): Renamed as ID_t
  336. (ID_t): New enum.
  337. * src/SuggestPieceMessage.h
  338. (ID): Renamed as ID_t
  339. (ID_t): New enum.
  340. * src/AllowedFastMessage.h
  341. (ID): Renamed as ID_t
  342. (ID_t): New enum.
  343. * src/PortMessage.h
  344. (ID): Renamed as ID_t
  345. (ID_t): New enum.
  346. * src/HaveNoneMessage.h
  347. (ID): Renamed as ID_t
  348. (ID_t): New enum.
  349. * src/KeepAliveMessage.h
  350. (ID): Renamed as ID_t
  351. (ID_t): New enum.
  352. * src/HaveAllMessage.h
  353. (ID): Renamed as ID_t
  354. (ID_t): New enum.
  355. * src/UnchokeMessage.h
  356. (ID): Renamed as ID_t
  357. (ID_t): New enum.
  358. * src/BitfieldMessage.h
  359. (ID): Renamed as ID_t
  360. (ID_t): New enum.
  361. * src/PieceMessage.h
  362. (ID): Renamed as ID_t
  363. (ID_t): New enum.
  364. * src/RequestMessage.h
  365. (ID): Renamed as ID_t
  366. (ID_t): New enum.
  367. * src/NotInterestedMessage.h
  368. (ID): Renamed as ID_t
  369. (ID_t): New enum.
  370. * src/ChokeMessage.h
  371. (ID): Renamed as ID_t
  372. (ID_t): New enum.
  373. * src/InterestedMessage.h
  374. (ID): Renamed as ID_t
  375. (ID_t): New enum.
  376. * src/HaveMessage.h
  377. (ID): Renamed as ID_t
  378. (ID_t): New enum.
  379. 2006-05-26 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  380. * src/PeerAbstractCommand.h
  381. (beforeSocketCheck): Removed.
  382. * src/PeerAbstractCommand.cc
  383. Modified in order to call executeInternal() even if socket check
  384. and upload limit check fail.
  385. * src/PeerInteractionCommand.h
  386. (keepAlive): Removed.
  387. (sendKeepAlive): New function.
  388. (checkHave): New function.
  389. (beforeSocketCheck): Removed.
  390. * src/PeerInteractionCommand.cc
  391. (executeInternal): Use peerInteraction->checkRequestSlot(). Added
  392. calls to checkHave() and sendKeepAlive().
  393. (keepAlive): Renamed to sendKeepAlive().
  394. (sendKeepAlive): New function.
  395. (beforeSocketCheck): Removed.
  396. (checkHave): New function.
  397. * src/BitfieldMan.cc
  398. (getMissingIndex): Don't call getMissingIndexRandomly() if max is 0.
  399. (getMissingUnusedIndex): Don't call getMissingIndexRandomly() if max is
  400. 0.
  401. (getMissingIndex): Dont't call getMissingIndexRandomly() if max is 0.
  402. * src/TorrentMan.h
  403. (UsedPieces): Removed.
  404. (Pieces): New type definition.
  405. * src/Piece.h: Updated doc.
  406. * src/Peer.h
  407. (totalLength): Removed.
  408. * src/Peer.cc
  409. (updateLatency): Fixed the latency calculation.
  410. * src/TorrentMan.cc
  411. (addPeer): Call deleteOldErrorPeers() only if peers.size() is higher
  412. than or equal to MAX_PEER_LIST_SIZE.
  413. If duplicate is false and peer.size() >= MAX_PEER_LIST_SIZE,
  414. then return false.
  415. (deleteOldErrorPeers): Rewritten.
  416. (deleteUsedPiece): Fixed the miss use of STL remove.
  417. * src/PeerInteraction.h
  418. (Pieces): Removed.
  419. (deleteTimeoutRequestSlot): Removed.
  420. (deleteCompletedRequestSlot): Removed.
  421. (checkRequestSlot): New function.
  422. * src/PeerInteraction.cc
  423. (deleteTimeoutRequestSlot): Merged to checkRequestSlot().
  424. (deleteCompletedRequestSlot): Merged to checkRequestSlot().
  425. (checkRequestSlot): New function.
  426. * src/DownloadEngine.cc
  427. (run): Clear activeSockets before calling waitData().
  428. (waitData): Removed a call to activeSockets.clear().
  429. 2006-05-24 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  430. To attempt to handle EINTR:
  431. * src/SocketCore.cc
  432. (isReadable): Added EINTR handling.
  433. (isWritable): Added EINTR handling.
  434. To improve the performance:
  435. * src/AbstractCommand.cc
  436. (isTimeoutDetected): Use Util::difftvsec() instead of Util::difftv().
  437. * src/PeerInteractionCommand.h
  438. (receiveMessage): Renamed as receiveMessages().
  439. (receiveMessages): New function.
  440. * src/PeerInteractionCommand.cc
  441. (executeInternal): receiveMessage loop is moved to new receiveMessages
  442. () function. detectMessageFlooding() is moved here.
  443. (detectMessageFlooding): Use Util::difftvsec() instead of Util::difftv
  444. (). The flooding detection for have message is comment out.
  445. (checkLongTimePeerChoking): Use Util::difftvsec() instead of
  446. Util::difftv().
  447. (receiveMessage): Renamed as receiveMessages().
  448. (receiveMessages): New function.
  449. (keepAlive): Use Util::difftvsec() instead of Util::difftv().
  450. (beforeSocketCheck): Commented out checkLongTimePeerChoking().
  451. * src/SleepCommand.cc
  452. (execute): Use Util::difftvsec() instead of Util::difftv().
  453. * src/BitfieldMan.h
  454. (getNthBitIndex): New function.
  455. (hasMissingPiece): New function.
  456. (getAllMissingIndexes): New function.
  457. * src/BitfieldMan.cc
  458. (countSetBit): Rewritten.
  459. (getNthBitIndex): New function.
  460. (getMissingIndexRandomly): Rewritten.
  461. (hasMissingPiece): New function.
  462. (getAllMissingIndexes): New function.
  463. * src/TorrentMan.cc
  464. (hasMissingPiece): New function.
  465. (deleteUsedPiece): Rewritten using STL.
  466. * src/PeerInteraction.cc
  467. (getNewPieceAndSendInterest): Use TorrentMan::hasMissingPiece(), which
  468. is a little bit faster then TorrentMan::getMissingPieceIndex().
  469. (addRequests): Updated the number of pending requests.
  470. * src/PeerAbstractCommand.cc
  471. (isTimeoutDetected): Use Util::difftvsec() instead of Util::difftv().
  472. (execute): Returns true if TorrentMan::isHalt() is true.
  473. Corrected the condition of upload limit checking.
  474. * src/Util.h
  475. (countBit): New function.
  476. * src/Util.cc
  477. (nbits): New variable.
  478. (countBit): New function.
  479. * src/DownloadEngine.h
  480. (SockCmdMap): New type definition.
  481. (waitData): Added an argument.
  482. (addSocket): Added an argument.
  483. (addSocketForReadCheck): Added an argument.
  484. (addSocketForWriteCheck): Added an argument.
  485. * src/DownloadEngine.cc
  486. (run): Executes only commands whose sockets are ready to read or write.
  487. All commands are executed in every 1 second.
  488. (waitData): Calls select() again if it returned
  489. EINTR.
  490. (addSocket): Saves socket and command object pair to the map.
  491. (deleteSocket): Deletes socket and command object pair from the map.
  492. (addSocketForReadCheck): Added an argument.
  493. (addSocketForWriteCheck): Added an argument.
  494. * src/DownloadCommand.cc
  495. (executeInternal): Use Util::difftvsec() instead of Util::difftv().
  496. To send "event=stopped" to the tracker when the application finishes:
  497. * src/PeerChokeCommand.h
  498. (checkPoint): New variable.
  499. * src/PeerChokeCommand.cc
  500. (PeerChokeCommand): Added the initialization of checkPoint.
  501. (execute): The interval check is now done by checkPoint, not
  502. SleepCommand. Return true if TorrentMan::isHalt() is true.
  503. * src/TorrentMan.h
  504. (halt): New function.
  505. (hasMissingPiece): New function.
  506. (isHalt): New function.
  507. (setHalt): New function.
  508. * src/TorrentMan.cc
  509. (TorrentMan): Added the initialization of halt.
  510. * src/TorrentAutoSaveCommand.h
  511. (checkPoint): New variable.
  512. * src/PeerListenCommand.cc
  513. (execute): Returns true if TorrentMan::isHalt() is true.
  514. * src/main.cc
  515. (setSignalHander): Added flags argument.
  516. (torrentHandler): Just calls TorrentMan::setHalt(true) and returns.
  517. (main): Set SA_ONESHOT flag of the signal hander of SIGINT and SIGTERM.
  518. Removed printDownloadAbortMessage() after torrent downloading loop.
  519. * src/TorrentAutoSaveCommand.cc
  520. (TorrentAutoSaveCommand): Added the initialization of checkPoint.
  521. (execute): Returns true if TorrentMan::isHalt() is true.
  522. The interval check is now done by checkPoint, not SleepCommand.
  523. * src/TrackerWatcherCommand.cc
  524. (execute): If TorrentMan::isHalt(), then create a tracker request with
  525. event=stopped.
  526. * src/TrackerUpdateCommand.cc
  527. (prepareForRetry): Do not use SleepCommand here.
  528. (execute): Returns true if TorrentMan::isHalt() is true.
  529. Others:
  530. * src/TorrentMan.cc
  531. (getMissingPieceIndex): Updated log message.
  532. * src/PeerInteraction.cc
  533. (createPeerMessag): Updated log message.
  534. 2006-05-20 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  535. To add the ability to download several pieces in mix in a command and
  536. increase the number of request slots according to request-cancel
  537. latency:
  538. * src/PeerInteractionCommand.cc
  539. (executeInternal): The number of messages to be received at a time
  540. is increased from 10 to 50.
  541. * src/LogFactory
  542. (getInstance): Added NullLogger.
  543. * src/NullLogger.h: New class.
  544. * src/BitfieldMan.h
  545. (getMissingIndex): New function.
  546. * src/BitfieldMan.cc
  547. (getMissingIndex): New function.
  548. * src/TorrentMan.h
  549. (checkOutPiece): New function.
  550. (getMissingPieceIndex): New function.
  551. (getMissingFastPieceIndex): New function.
  552. (getMissingFastPiece): New function.
  553. * src/TorrentMan.cc
  554. (updatePiece): Rewritten using STL.
  555. (syncPiece): Rewritten using STL.
  556. (getMissingPiece): Rewritten using getMissingPieceIndex() and
  557. checkOutPiece().
  558. (getMissingPieceIndex): New function.
  559. (getMissingFastPieceIndex): New function.
  560. (getMissingFastPiece): New function.
  561. (checkOutPiece): New function.
  562. * src/PeerInteraction.h
  563. (Pieces): New type definition.
  564. (piece): Removed.
  565. (pieces): New variable.
  566. (getNewPieceAndSendInterest): Added the "piece" argument.
  567. (abortPiece): Added the "piece" argument.
  568. (abortAllPieces): New function.
  569. (isInRequestSlot): New function.
  570. (hasDownloadPiece): Added the "index" argument.
  571. (setDownloadPiece): Removed.
  572. (getDownloadPiece): Added the "index" argument.
  573. (updatePiece): New function.
  574. (createRequestMessage): Added the "index" argument.
  575. * src/PeerInteraction.cc
  576. (onChoked): Rewritten.
  577. (abortPiece): Rewirtten.
  578. (abortAllPieces): New function.
  579. (deleteTimeoutRequestSlot): Rewritten.
  580. Clarified code a little bit.
  581. (deleteCompletedRequestSlot): Rewritten.
  582. (isInRequestSlot): New function.
  583. (syncPiece): Rewritten.
  584. (updatePiece): New function.
  585. (getNewPieceAndSendInterest): Rewritten.
  586. (addRequests): Rewritten.
  587. (getDownloadPiece): Rewritten.
  588. (hasDownloadPiece): Rewritten.
  589. (createRequestMessage): Added the "index" argument.
  590. * src/common.h
  591. (BITFIELD_LEN_FROM_PIECES): Enclosed the variable in parentheses.
  592. (DIV_FLOOR): New definition.
  593. * src/PieceMessage.cc
  594. (receivedAction): Update request-piece latency here.
  595. * src/RequestSlot.h
  596. (getLatencyInMillis): New function.
  597. * src/RequestSlot.cc
  598. (isTimeout): Rewritten using getLatencyInMillis.
  599. (getLatencyInMillis): New function.
  600. * src/Piece.h
  601. (operator==): New function.
  602. (getMissingBlockIndex): New function.
  603. * src/Piece.cc
  604. (operator==): New function.
  605. (getMissingBlockIndex): New function.
  606. * src/Peer.h
  607. (DEFAULT_LATENCY): New definition.
  608. (latency): New variable.
  609. (updateLatency): New function.
  610. (getLatency): New function.
  611. * src/Peer.cc
  612. (resetStatus): Reset latecy.
  613. (updateLatency): New function.
  614. 2006-05-20 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  615. * src/SocketCore.cc
  616. (isReadable): Added secure to the condition.
  617. * src/HttpConnection.cc
  618. (receiveResponse): Fixed a bug that causes no response header
  619. exception.
  620. * src/Peer.h
  621. (getFastSet): Fixed the return value type.
  622. 2006-05-18 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  623. To remove a wait from download loop:
  624. * src/DownloadEngine.cc
  625. (run): Comment out shortSleep.
  626. To rewrite the message handling:
  627. * src/SimplePeerMessage.h: New class.
  628. * src/SimplePeerMessage.cc: New class.
  629. * src/CancelMessage.h: Derived from SimplePeerMessage.
  630. (msg): New variable.
  631. (create): New function.
  632. (send): Removed.
  633. (getMessage): New function.
  634. (getMessageLength): New function.
  635. * src/CancelMessage.cc
  636. (create): New function.
  637. (receivedAction): Replaced deleteRequestMessageInQueue with
  638. rejectPieceMessageInQueue.
  639. (send): Removed.
  640. (getMessage): New function.
  641. (getMessageLength): New function.
  642. * src/BitfieldMessage.h: Derived from SimplePeerMessage.
  643. (msg): New variable.
  644. (msgLength): New variable.
  645. (~BitfieldMessage): Deleted msg.
  646. (send): Removed.
  647. (getMessage): New function.
  648. (getMessageLength): New function.
  649. * src/BitfieldMessage.cc
  650. (create): New function.
  651. (send): Removed.
  652. (getMessage): New function.
  653. (getMessageLength): New function.
  654. * src/ChokeMessage.h: Derived from SimplePeerMessage.
  655. (msg): New variable.
  656. (sendPredicate): New function.
  657. (onSendComplete): New function.
  658. (send): Removed.
  659. (getMessage): New function.
  660. (getMessageLength): New function.
  661. (create): New function.
  662. * src/ChokeMessage.cc
  663. (create): New function.
  664. (send): Removed.
  665. (sendPredicate): New function.
  666. (getMessage): New function.
  667. (getMessageLength): New function.
  668. (onSendComplete): New function.
  669. * src/KeepAliveMessage.h: Derived from SimplePeerMessage.
  670. (msg): New variable.
  671. (send): Removed.
  672. (getMessage): New function.
  673. (getMessageLength): New function.
  674. * src/KeepAliveMessage.cc
  675. (send): Removed.
  676. (getMessage): New function.
  677. (getMessageLength): New function.
  678. * src/PortMessage.h
  679. (create): New function.
  680. (receivedAction): Updated log message.
  681. * src/PortMessage.cc: New file.
  682. * src/UnchokeMessage.h: Derived from SimplePeerMessage.
  683. (msg): New variable.
  684. (sendPredicate): New function.
  685. (onSendComplete): New function.
  686. (create): New function.
  687. (send): Removed.
  688. (getMessage): New function.
  689. (getMessageLength): New function.
  690. * src/UnchokeMessage.cc
  691. (create): New function.
  692. (send): Removed.
  693. (sendPredicate): New function.
  694. (getMessage): New function.
  695. (getMessageLength): New function.
  696. (onSendComplete): New function.
  697. * src/PieceMessage.h
  698. (leftPieceDataLength): Removed.
  699. (leftDataLength): New variable.
  700. (headerSend): New variable.
  701. (pendingCount): New variable.
  702. (msgHeader): New variable.
  703. (sendPieceData): New function.
  704. (incrementPendingCount): New function.
  705. (isPendingCountMax): New function.
  706. (create): New function.
  707. (getMessageHeader): New function.
  708. (getMessageHeaderLength): New function.
  709. * src/PieceMessage.cc
  710. (create): New function.
  711. (getMessageHeader): New function.
  712. (getMessageHeaderLength): New function.
  713. (send): Rewritten.
  714. (sendPieceData): New function.
  715. * src/HaveMessage.h: Derived from SimplePeerMessage.
  716. (msg): New variable.
  717. (create): New function.
  718. (getMessage): New function.
  719. (getMessageLength): New function.
  720. * src/HaveMessage.cc
  721. (create): New function.
  722. (send): Removed.
  723. (sendPieceData): New function.
  724. (getMessage): New function.
  725. (getMessageLength): New function.
  726. * src/RequestMessage.h: Derived from SimplePeerMessage.
  727. (msg): New variable.
  728. (create): New function.
  729. (send): Removed.
  730. (getMessage): New function.
  731. (getMessageLength): New function.
  732. * src/RequestMessage.cc
  733. (create): New function.
  734. (receivedAction): Added the handling of fast extension.
  735. Deleted torrentMan->addUploadLength, torrentMan->addDeltaUploadLength.
  736. (send): Removed.
  737. (getMessage): New function.
  738. (getMessageLength): New function.
  739. * src/InterestedMessage.h: Derived from SimplePeerMessage.
  740. (msg): New variable.
  741. (sendPredicate): New function.
  742. (onSendComplete): New function.
  743. (create): New function.
  744. (getMessage): New function.
  745. (getMessageLength): New function.
  746. * src/InterestedMessage.cc
  747. (create): New function.
  748. (send): Removed.
  749. (sendPieceData): New function.
  750. (getMessage): New function.
  751. (getMessageLength): New function.
  752. (onSendComplete): New function.
  753. * src/NotInterestedMessage.h: Derived from SimplePeerMessage.
  754. (msg): New variable.
  755. (sendPieceData): New function.
  756. (onSendComplete): New function.
  757. (create): New function.
  758. (send): Removed.
  759. (getMessage): New function.
  760. (getMessageLength): New function.
  761. * src/NotInterestedMessage.cc
  762. (create): New function.
  763. (send): Removed.
  764. (sendPredicate): New function.
  765. (getMessage): New function.
  766. (getMessageLength): New function.
  767. (onSendComplete): New function.
  768. * src/AllowedFastMessage.h: New class.
  769. * src/AllowedFastMessage.cc: New class.
  770. * src/RejectMessage.h: New class.
  771. * src/RejectMessage.cc: New class.
  772. * src/SuggestPieceMessage.h: New class.
  773. * src/SuggestPieceMessage.cc: New class.
  774. * src/HaveAllMessage.h: New class.
  775. * src/HaveAllMessage.cc: New class.
  776. * src/HaveNoneMessage.h: New class.
  777. * src/HaveNoneMessage.cc: New class.
  778. * src/HandshakeMessage.h: Derived from SimplePeerMessage.
  779. (msg): New variable.
  780. (reserved): New variable.
  781. (create): New function.
  782. (getId): New function.
  783. (receivedAction): New function.
  784. (getMessage): New function.
  785. (getMessageLength): New function.
  786. (isFastExtensionSupported): New function.
  787. * src/HandshakeMessage.cc
  788. (HandshakeMessage): Moved here from HandshakeMessage.h.
  789. (create): New function.
  790. (getMessage): New function.
  791. (getMessageLength): New function.
  792. (toString): Added the output of reserved field.
  793. (check): Added const qualifier.
  794. (isFastExtensionSupported): New function.
  795. * src/PeerMessageUtil.h
  796. (createChokeMessage): Removed.
  797. (createUnchokeMessage): Removed.
  798. (createInterestedMessage): Removed.
  799. (createNotInterestedMessage): Removed.
  800. (createHaveMessage): Removed.
  801. (createBitfieldMessage): Removed.
  802. (createRequestMessage): Removed.
  803. (createCancelMessage): Removed.
  804. (createPieceMessage): Removed.
  805. (createPortMessage): Removed.
  806. (createChokeMessage): Removed.
  807. (createUnchokeMessage): Removed.
  808. (createInterestedMessage): Removed.
  809. (createNotInterestedMessage): Removed.
  810. (createHaveMessage): Removed.
  811. (createBitfieldMessage): Removed.
  812. (createRequestMessage): Removed.
  813. (createCancelMessage): Removed.
  814. (createPieceMessage): Removed.
  815. (createKeepAliveMessage): Removed.
  816. (createHandshakeMessage): Removed.
  817. (setIntParam): New function.
  818. (createPeerMessageString): New function.
  819. * src/PeerMessageUtil.cc
  820. (createChokeMessage): Removed.
  821. (createUnchokeMessage): Removed.
  822. (createInterestedMessage): Removed.
  823. (createNotInterestedMessage): Removed.
  824. (createHaveMessage): Removed.
  825. (createBitfieldMessage): Removed.
  826. (createRequestMessage): Removed.
  827. (createCancelMessage): Removed.
  828. (createPieceMessage): Removed.
  829. (createPortMessage): Removed.
  830. (createRequestMessage): Removed.
  831. (createCancelMessage): Removed.
  832. (createPieceMessage): Removed.
  833. (createHaveMessage): Removed.
  834. (createChokeMessage): Removed.
  835. (createUnchokeMessage): Removed.
  836. (createInterestedMessage): Removed.
  837. (createNotInterestedMessage): Removed.
  838. (createBitfieldMessage): Removed.
  839. (createKeepAliveMessage): Removed.
  840. (createHandshakeMessage): Removed.
  841. (setIntParam): New function.
  842. (createPeerMessageString): New function.
  843. * src/PeerConnection.h
  844. (peer): Removed.
  845. (torrentMan): Removed.
  846. (createNLengthMessage): Removed.
  847. (setIntParam): Removed.
  848. (writeOutgoingMessageLog): Removed all overloaded functions.
  849. (PeerConnection): Deleted peer and torrentMan from its arguments.
  850. (sendMessage): New function.
  851. (sendHandshake): Removed.
  852. (sendKeepAlive): Removed.
  853. (sendChoke): Removed.
  854. (sendUnchoke): Removed.
  855. (sendInterested): Removed.
  856. (sendNotInterested): Removed.
  857. (sendHave): Removed.
  858. (sendBitfield): Removed.
  859. (sendRequest): Removed.
  860. (sendPiece): Removed.
  861. (sendPieceHeader): Removed.
  862. (sendPieceData): Removed.
  863. (sendCancel): Removed.
  864. (getPeer): Removed.
  865. * src/PeerConnection.cc
  866. (PeerConnection): Deleted peer and torrentMan from its arguments.
  867. (sendHandshake): Removed.
  868. (sendKeepAlive): Removed.
  869. (createNLengthMessage): Removed.
  870. (setIntParam): Removed.
  871. (writeOutgoingMessageLog): Removed all overloaded functions.
  872. (sendChoke): Removed.
  873. (sendUnchoke): Removed.
  874. (sendInterested): Removed.
  875. (sendNotInterested): Removed.
  876. (sendHave): Removed.
  877. (sendBitfield): Removed.
  878. (sendRequest): Removed.
  879. (sendPiece): Removed.
  880. (sendPieceHeader): Removed.
  881. (sendPieceData): Removed.
  882. (sendMessage): New function.
  883. (sendCancel): Removed.
  884. * src/PeerInteractionCommand.cc
  885. (PeerInteractionCommand): Call setUploadLimit.
  886. (executeInternal): Call setUploadLimit.
  887. Added the handling of "inProgress" state of handshake message.
  888. Call sendBitfield() or sendAllowdFast() instead of deprecated
  889. sendNow().
  890. (keepAlive): Call addMessage and sendMessage instead of deprecated
  891. sendNow().
  892. (beforeSocketCheck): Call addMessage instead of deprecated trySendNow()
  893. * src/TorrentMan.h
  894. (PEER_ID_LENGTH): New definition.
  895. (hasAllPieces): New function.
  896. * src/TorrentMan.cc
  897. (getMissingPiece): Added the handling of fast extension.
  898. (cancelPiece): Call updatePiece().
  899. (hasAllPieces): New function.
  900. * src/PeerInteraction.h
  901. (fastSet): New variable.
  902. (getNewPieceAndSendInterest): Changed the return type to void.
  903. (send): Renamed as sendMessages.
  904. (deleteAllRequestSlot): Removed.
  905. (deleteRequestMessageInQueue): Renamed as rejectPieceMessageInQueue.
  906. (cancelAllRequest): Removed all overloaded functions.
  907. (deleteAllRequestSlot): Removed.
  908. (deletePieceMessageInQueue): Renamed as rejectAllPieceMessageInQueue.
  909. (rejectPieceMessageInQueue): New function.
  910. (rejectAllPieceMessageInQueue): New function.
  911. (onChoked): New function.
  912. (isSendingMessageInProgress): New function.
  913. (getCorrespondingRequestSlot): Changed its arguments.
  914. (isInFastSet): New function.
  915. (addFastSetIndex): New function.
  916. (addRequests): New function.
  917. (sendNow): Removed.
  918. (trySendNow): Removed.
  919. (sendBitfield): New function.
  920. (sendAllowdFast): New function.
  921. (createHaveAllMessage): New function.
  922. (createHaveNoneMessage): New function.
  923. (createRejectMessage): New function.
  924. (createAllowedFastMessage): New function.
  925. * src/PeerInteraction.cc
  926. (send): Renamed as sendMessages.
  927. (sendMessages): New function.
  928. (MsgPushBack): New class.
  929. (isSendingMessageInProgress): New function.
  930. (deletePieceMessageInQueue): Renamed as rejectAllPieceMessageInQueue.
  931. (rejectAllPieceMessageInQueue): New function.
  932. Added the handling of fast extension.
  933. (deleteRequestMessageInQueue): Renamed as rejectPieceMessageInQueue.
  934. (rejectPieceMessageInQueue): New function.
  935. Added the handling of fast extension.
  936. (deleteRequestSlot): Replaced for loop with std::find.
  937. (onChoked): New function.
  938. (deleteAllRequestSlot): Removed.
  939. (abortPiece): Rewirtten.
  940. (deleteTimeoutRequestSlot): Updated log messages.
  941. (getCorrespondingRequestSlot): Changed its arguments.
  942. (cancelAllRequest): Removed all overloaded functions.
  943. (receiveHandshake): Added the check to see whether an incoming peer
  944. supports fast extension.
  945. (createHandshakeMessage): Use HandshakeMessage::create instead of
  946. PeerMessageUtil.
  947. (createPeerMessage): Use create() of each message class instead of
  948. PeerMessageUtil.
  949. HaveAllMessage, HaveNoneMessage, RejectMessage, SuggestPieceMessage,
  950. AllowedFastMessage were added.
  951. (getNewPieceAndSendInterest): Changed its return value type to void.
  952. Added the handling of fast extension.
  953. (addRequests): New function.
  954. (sendNow): Removed.
  955. (sendHandshake): Rewritten.
  956. (trySendNow): Removed.
  957. (sendBitfield): New function.
  958. (sendAllowdFast): New function.
  959. (isInFastSet): New function.
  960. (addFastSetIndex): New function.
  961. (createRequestMessage): Use RequestMessage::create instead of
  962. PeerMessageUtil.
  963. (createCancelMessage): Use CancelMessage::create instead of
  964. PeerMessageUtil.
  965. (createPieceMessage): Use PieceMessage::create instead of
  966. PeerMessageUtil.
  967. (createHaveMessage): Use HaveMessage::create instead of
  968. PeerMessageUtil.
  969. (createChokeMessage): Use ChokeMessage::create instead of
  970. PeerMessageUtil.
  971. (createUnchokeMessage): Use UnchokeMessage::create instead of
  972. PeerMessageUtil.
  973. (createInterestedMessage): Use InterestedMessage::create instead of
  974. PeerMessageUtil.
  975. (createNotInterestedMessage): Use NotInterestedMessage::create instead
  976. of PeerMessageUtil.
  977. (createBitfieldMessage): Use BitfieldMessage::create instead of
  978. PeerMessageUtil.
  979. (createKeepAliveMessage): Use KeepAliveMessage::create instead of
  980. PeerMessageUtil.
  981. (createHaveAllMessage): New function.
  982. (createHaveNoneMessage): New function.
  983. (createRejectMessage): New function.
  984. (createAllowedFastMessage: New function.
  985. * src/Util.h
  986. (sha1Sum): New function.
  987. (computeFastSet): New function.
  988. * src/Util.cc
  989. (sha1Sum): New function.
  990. (computeFastSet): New function.
  991. * src/Peer.h
  992. (fastExtensionEnabled): New variable.
  993. (fastSet): New variable.
  994. (setAllBitfield): New function.
  995. (setFastExtensionEnabled): New function.
  996. (isFastExtensionEnabled): New function.
  997. (addFastSetIndex): New function.
  998. (getFastSet): New function.
  999. (isInFastSet): New function.
  1000. (countFastSet): New function.
  1001. * src/Peer.cc
  1002. (isInFastSet): New function.
  1003. (addFastSetIndex): New function.
  1004. (setAllBitfield): New function.
  1005. * src/AbstractCommand.cc (execute): Changed the procedure of checking
  1006. sockets.
  1007. * src/PeerAbstractCommand.cc
  1008. (PeerAbstractCommand): Added the initialization for uploadLimitCheck
  1009. and uploadLimit.
  1010. (execute): Changed the procedure of checking sockets. The upload speed
  1011. checking were added.
  1012. (setUploadLimit): New function.
  1013. (setUploadLimitCheck): New function.
  1014. * src/PeerAbstractCommand.h
  1015. (setUploadLimit): New function.
  1016. (setUploadLimitCheck): New function.
  1017. (uploadLimit): New variable.
  1018. (uploadLimitCheck): New variable.
  1019. To contact a tracker regularly:
  1020. * src/TrackerWatcherCommand.h (interval): New variable.
  1021. (checkPoint): New variable.
  1022. (TrackerWatcherCommand): Added interval argument.
  1023. * src/TrackerWatcherCommand.cc
  1024. (TrackerWatcherCommand): Initialized checkPoint.
  1025. (execute): Now a tracker is contacted in every specified period.
  1026. If peer list is not needed, send request with numwant=0.
  1027. * src/TrackerUpdateCommand.cc
  1028. (execute): Updated log messages.
  1029. * src/DownloadEngine.cc
  1030. (~DownloadEngine): Removed two asserts.
  1031. (waitData): Uncommented wfds. May be a bug fix.
  1032. 2006-05-10 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  1033. * src/PeerInteractionCommand.h
  1034. (checkInactiveConnection): Removed.
  1035. * src/PeerInteractionCommand.cc
  1036. (executeInternal): Removed following function calls:
  1037. detectMessageFlooding(), checkLongTimePeerChoking and
  1038. checkInactiveConnection().
  1039. (checkInactiveConnection): Removed.
  1040. (detectMessageFlooding): Removed function call to
  1041. checkInactiveConnection().
  1042. * src/PeerMessageUtil.h
  1043. (createChokeMessage): New function. Overload.
  1044. (createUnchokeMessage): New function. Overload.
  1045. (createInterestedMessage): New function. Overload.
  1046. (createNotInterestedMessage): New function. Overload.
  1047. (createHaveMessage): New function. Overload.
  1048. (createBitfieldMessage): New function. Overload.
  1049. (createRequestMessage): New function. Overload.
  1050. (createCancelMessage): New function. Overload.
  1051. (createPieceMessage): New function. Overload.
  1052. (createKeepAliveMessage): New function. Overload.
  1053. * src/PeerMessageUtil.cc
  1054. (createChokeMessage): New function. Overload.
  1055. (createUnchokeMessage): New function. Overload.
  1056. (createInterestedMessage): New function. Overload.
  1057. (createNotInterestedMessage): New function. Overload.
  1058. (createHaveMessage): New function. Overload.
  1059. (createBitfieldMessage): New function. Overload.
  1060. (createRequestMessage): New function. Overload.
  1061. (createCancelMessage): New function. Overload.
  1062. (createPieceMessage): New function. Overload.
  1063. (createKeepAliveMessage): New function. Overload.
  1064. * src/SendMessageQueue.cc
  1065. (createRequestMessage): Use PeerMessageUtil.
  1066. (createCancelMessage): Use PeerMessageUtil.
  1067. (createPieceMessage): Use PeerMessageUtil.
  1068. (createHaveMessage): Use PeerMessageUtil.
  1069. (createChokeMessage): Use PeerMessageUtil.
  1070. (createUnchokeMessage): Use PeerMessageUtil.
  1071. (createInterestedMessage): Use PeerMessageUtil.
  1072. (createNotInterestedMessage): Use PeerMessageUtil.
  1073. (createBitfieldMessage): Use PeerMessageUtil.
  1074. (createKeepAliveMessage): Use PeerMessageUtil.
  1075. * src/SendMessageQueue.h: Renamed to PeerInteraction.h
  1076. * src/SendMessageQueue.cc: Renamed to PeerInteraction.cc
  1077. * src/PeerInteraction.h: New class.
  1078. * src/PeerInteraction.cc: New class.
  1079. 2006-05-09 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  1080. Each peer message has its own class.
  1081. * src/PendingMessages.h: Removed.
  1082. * src/PendingMessages.cc: Removed. The sending process was moved to
  1083. each message class.
  1084. * src/RequestSlotMan.h: Removed.
  1085. * src/RequestSlotMan.cc: Removed. All functionarities were moved to
  1086. SendMessageQueue.
  1087. * src/RequestMessage.h: New class.
  1088. * src/RequestMessage.cc: New class.
  1089. * src/CancelMessage.h: New class.
  1090. * src/CancelMessage.cc: New class.
  1091. * src/BitfieldMessage.h: New class.
  1092. * src/BitfieldMessage.cc: New class.
  1093. * src/ChokeMessage.h: New class.
  1094. * src/ChokeMessage.cc: New class.
  1095. * src/KeepAliveMessage.h: New class.
  1096. * src/KeepAliveMessage.cc: New class.
  1097. * src/PortMessage.h: New class.
  1098. * src/UnchokeMessage.h: New class.
  1099. * src/UnchokeMessage.cc: New class.
  1100. * src/PieceMessage.h: New class.
  1101. * src/PieceMessage.cc: New class.
  1102. * src/HaveMessage.h: New class.
  1103. * src/HaveMessage.cc: New class.
  1104. * src/BitfieldMessage.h: New class.
  1105. * src/BitfieldMessage.cc: New class.
  1106. * src/NotInterestedMessage.h: New class.
  1107. * src/NotInterestedMessage.cc: New class.
  1108. * src/InterestedMessage.h: New class.
  1109. * src/InterestedMessage.cc: New class.
  1110. * src/HandshakeMessage.h (sendMessageQueue): New variable.
  1111. (getSendMessageQueue): New function.
  1112. (setSendMessageQueue): New function.
  1113. * src/HandshakeMessage.cc: New class.
  1114. * src/PeerConnection.h (receiveMessage): Changed return value and
  1115. arguments.
  1116. (receiveHandshake): Changed return value and arguments.
  1117. * src/PeerConnection.cc (receiveMessage): Do not create message class
  1118. here.
  1119. (receiveHandshake): Do not create handshake class here.
  1120. * src/PeerInteractionCommand.h (peerConnection): Removed.
  1121. (piece): Removed.
  1122. (syncPiece): Removed.
  1123. (sendInterest): Removed.
  1124. (sendMessages): Removed.
  1125. (createRequestPendingMessage): Removed.
  1126. (checkPieceHash): Removed.
  1127. (erasePieceOnDisk): Removed.
  1128. (getNewPieceAndSendInterest): Removed.
  1129. (onGotNewPice): Removed.
  1130. (onGotWrongPiece): Removed.
  1131. * src/PeerInteractionCommand.cc (PeerInteractionCommand):
  1132. Removed peerConnection, piece.
  1133. (~PeerInteractionCommand): Removed peerConnection.
  1134. (executeInternal): Use sendMessageQueue instead of peerConnection.
  1135. (syncPiece): Moved to SendMessageQueue.
  1136. (decideChoking): Removed PendingMessage.
  1137. (receiveMessage): Use sendMessageQueue instead of peerConnection.
  1138. The action after receiving peer message was moved to each message
  1139. class.
  1140. (onGotNewPice): Moved to SendMessageQueue.
  1141. (onGotWrongPiece): Moved to SendMessageQueue.
  1142. (getNewPieceAndSendInterest): Moved to SendMessageQueue.
  1143. (sendInterest): Moved to SendMessageQueue.
  1144. (createRequestPendingMessage): Removed.
  1145. (sendMessages): Moved to SendMessageQueue.
  1146. (onAbort): Use SendMessageQueue::abortPiece()
  1147. (keepAlive): Use sendMessageQueue instead of peerConnection.
  1148. (beforeSocketCheck): Use sendMessageQueue instead of peerConnection.
  1149. (checkPieceHash): Moved to SendMessageQueue.
  1150. (erasePieceOnDisk): Moved to SendMessageQueue.
  1151. * src/PeerMessageUtil.h
  1152. (createBitfieldMessage): Removed.
  1153. (createHaveMessage): Changed return value and arguments.
  1154. (createBitfieldMessage): Changed return value and arguments.
  1155. (createRequestCancelMessage): Removed.
  1156. (createPieceMessage): Changed return value and arguments.
  1157. (getShortIntParam): New function.
  1158. (checkIndex): Changed arguments.
  1159. (checkBegin): Changed arguments.
  1160. (checkLength): Changed arguments.
  1161. (checkPieceOffset): Removed.
  1162. (checkRange): New function.
  1163. (checkBitfield): Changed arguments.
  1164. (createPeerMessage): Removed.
  1165. (checkIntegrity): Removed.
  1166. (createHandshakeMessage): Changed arguments.
  1167. (createChokeMessage): New function.
  1168. (createUnchokeMessage): New function.
  1169. (createInterestedMessage): New function.
  1170. (createNotInterestedMessage): New function.
  1171. (createRequestMessage): New function.
  1172. (createCancelMessage): New function.
  1173. (createPortMessage): New function.
  1174. * src/PeerMessageUtil.cc
  1175. (createBitfieldMessage): Removed.
  1176. (createHaveMessage): Changed return value and arguments.
  1177. (createBitfieldMessage): Changed return value and arguments.
  1178. (createRequestCancelMessage): Removed.
  1179. (createPieceMessage): Changed return value and arguments.
  1180. (getShortIntParam): New function.
  1181. (checkIndex): Changed arguments.
  1182. (checkBegin): Changed arguments.
  1183. (checkLength): Changed arguments.
  1184. (checkPieceOffset): Removed.
  1185. (checkRange): New function.
  1186. (checkBitfield): Changed arguments.
  1187. (createPeerMessage): Removed.
  1188. (checkIntegrity): Removed.
  1189. (createHandshakeMessage): Changed arguments.
  1190. (createChokeMessage): New function.
  1191. (createUnchokeMessage): New function.
  1192. (createInterestedMessage): New function.
  1193. (createNotInterestedMessage): New function.
  1194. (createRequestMessage): New function.
  1195. (createCancelMessage): New function.
  1196. (createPortMessage): New function.
  1197. * src/PeerMessage.h
  1198. (id): Removed.
  1199. (index): Removed.
  1200. (begin): Removed.
  1201. (length): Removed.
  1202. (bitfield): Removed.
  1203. (bitfieldLength): Removed.
  1204. (block): Removed.
  1205. (blockLength): Removed.
  1206. (inProgress): New variable.
  1207. (cuid): New variable.
  1208. (peer): New variable.
  1209. (sendMessageQueue): New variable.
  1210. (logger): New variable.
  1211. (setBitfield): Removed.
  1212. (getBitfield): Removed.
  1213. (setBlock): Removed.
  1214. (getBlock): Removed.
  1215. (getBitfieldLength): Removed.
  1216. (getBlockLength): Removed.
  1217. (isInProgress): New function.
  1218. (toString): Made pure virtual.
  1219. (check): New function.
  1220. (send): New function.
  1221. (receivedAction): New function.
  1222. (getId): Made pure virtual.
  1223. (setId): Removed.
  1224. (getIndex): Removed.
  1225. (setIndex): Removed.
  1226. (getBegin): Removed.
  1227. (setBegin): Removed.
  1228. (getLength): Removed.
  1229. (setLength): Removed.
  1230. (getCuid): New function.
  1231. (setCuid): New function.
  1232. (getPeer): New function.
  1233. (setPeer): New function.
  1234. (getSendMessageQueue): New function.
  1235. (setSendMessageQueue): New function.
  1236. (ID): Removed.
  1237. * src/PeerMessage.cc
  1238. (setBitfield): Removed.
  1239. (setBlock): Removed.
  1240. (toString): Removed.
  1241. * src/TorrentMan.h
  1242. (getPieceLength): New function.
  1243. (getPieceLength): New function.
  1244. * src/SendMessageQueue.h
  1245. (REQUEST_TIME_OUT): New definition.
  1246. (RequestSlots): New definition.
  1247. (MessageQueue): New definition.
  1248. (requestSlotMan): Removed.
  1249. (pendingMessages): Removed.
  1250. (requestSlots): New variable.
  1251. (messageQueue): New variable.
  1252. (torrentMan): New variable.
  1253. (peerConnection): New variable.
  1254. (peer): New variable.
  1255. (piece): New variable.
  1256. (getNewPieceAndSendInterest): New function.
  1257. (createPeerMessage): New function.
  1258. (createHandshakeMessage): New function.
  1259. (send): Made private.
  1260. (setPeerMessageCommonProperty): New function.
  1261. (deleteAllRequestSlot): New function.
  1262. (deleteRequestMessageInQueue): New function.
  1263. (cancelAllRequest): Made private.
  1264. (cancelAllRequest): Made private.
  1265. (countRequestSlot): Made private.
  1266. (addPendingMessage): Removed.
  1267. (deletePendingPieceMessage): Removed.
  1268. (deletePendingRequestMessage): Removed.
  1269. (addMessage): New function.
  1270. (deletePieceMessageInQueue): New function.
  1271. (deleteTimeoutRequestSlot): Changed argument.
  1272. (deleteCompletedRequestSlot): Changed argument.
  1273. (getCorrespoindingRequestSlot): Renamed to getCorrespondingRequestSlot.
  1274. (getCorrespondingRequestSlot): New function.
  1275. (countPendingMessage): Removed.
  1276. (countMessageInQueue): New function.
  1277. (getTorrentMan): New function.
  1278. (getPeerConnection): New function.
  1279. (hasDownloadPiece): New function.
  1280. (getDownloadPiece): New function.
  1281. (setDownloadPiece): New function.
  1282. (syncPiece): New function.
  1283. (sendMessages): New function.
  1284. (sendNow): New function.
  1285. (trySendNow): New function.
  1286. (abortPiece): New function.
  1287. (sendHandshake): New function.
  1288. (receiveMessage): New function.
  1289. (receiveHandshake): New function.
  1290. (createRequestMessage): New function.
  1291. (createCancelMessage): New function.
  1292. (createPieceMessage): New function.
  1293. (createHaveMessage): New function.
  1294. (createChokeMessage): New function.
  1295. (createUnchokeMessage): New function.
  1296. (createInterestedMessage): New function.
  1297. (createNotInterestedMessage): New function.
  1298. (createBitfieldMessage): New function.
  1299. (createKeepAliveMessage): New function.
  1300. * src/SendMessageQueue.cc
  1301. (SendMessageQueue): Removed requestSlotMan.
  1302. Instantiated peerConnection here.
  1303. (~SendMessageQueue): Removed requestSlotMan.
  1304. Added deletion of peerConnection and the contents of messageQueue.
  1305. (send): Updated according to the change of messageQueue.
  1306. (addPendingMessage): Renamed to addMessage.
  1307. (addMessage): New function.
  1308. (deletePendingPieceMessage): Renamed to deletePieceMessageInQueue.
  1309. (deletePieceMessageInQueue): New function.
  1310. (deletePendingRequestMessage): Renamed to deleteRequestMessageInQueue.
  1311. (deleteRequestMessageInQueue): New function.
  1312. (deleteRequestSlot): RequestSlotMan::deleteRequestSlot(...) was moved
  1313. here.
  1314. (deleteTimeoutRequestSlot): RequestSlotMan::deleteTimeoutRequestSlot
  1315. (...) was moved here.
  1316. (deleteAllRequestSlot): RequestSlotMan::deleteAllRequestSlot(...) was
  1317. moved here.
  1318. (deleteCompletedRequestSlot):
  1319. RequestSlotMan::deleteCompletedRequestSlot(...) was moved here.
  1320. (getCorrespondingRequestSlot):
  1321. RequestSlotMan::getCorrespoindingRequestSlot(...) was moved here.
  1322. And renamed to getCorrespondingRequestSlot, correcting a typo.
  1323. (countPendingMessage): Renamed to countMessageInQueue.
  1324. (countMessageInQueue): New function.
  1325. (countRequestSlot): RequestSlotMan::countRequestSlot() was moved here.
  1326. (receiveHandshake): New function.
  1327. (createHandshakeMessage): New function.
  1328. (receiveMessage): New function.
  1329. (createPeerMessage): New function.
  1330. (syncPiece): New function.
  1331. (getNewPieceAndSendInterest): New function.
  1332. (sendMessages): New function.
  1333. (sendNow): New function.
  1334. (trySendNow): New function.
  1335. (sendHandshake): New function.
  1336. (abortPiece): New function.
  1337. (getDownloadPiece): New function.
  1338. (getPeerMessageCommonProperty): New function.
  1339. (createRequestMessage): New function.
  1340. (createCancelMessage): New function.
  1341. (createPieceMessage): New function.
  1342. (createHaveMessage): New function.
  1343. (createChokeMessage): New function.
  1344. (createUnchokeMessage): New function.
  1345. (createInterestedMessage): New function.
  1346. (createNotInterestedMessage): New function.
  1347. (createBitfieldMessage): New function.
  1348. (createKeepAliveMessage): New function.
  1349. To add simple Content-Disposition support:
  1350. * src/HttpResponseCommand.h (determinFilename): New function.
  1351. * src/HttpResponseCommand.cc (executeInternal):
  1352. Use determinFilename(headers) instead of req->getFile() when comparing
  1353. filename.
  1354. (determinFilename): New function.
  1355. (handleDefaultEncoding): Use determinFilename(headers) instead of
  1356. req->getFile().
  1357. (handleOtherEncoding): Use determinFilename(headers) instead of
  1358. req->getFile().
  1359. * src/Util.h (getContentDispositionFilename): New function.
  1360. * src/Util.cc (getContentDispositionFilename): New function.
  1361. * src/LogFactory.h (release): New function.
  1362. * src/LogFactory.cc (release): New function.
  1363. To fix a bug that causes out-of-bound exception when HTTP status
  1364. line is wrong:
  1365. * src/HttpConnection.cc (receiveResponse): Added a check for header
  1366. size.
  1367. * src/common.h (Deleter): New class.
  1368. * src/SegmentMan.cc
  1369. (~SegmentMan): Added deletion of splitter and diskWriter.
  1370. * src/DownloadEngine.h
  1371. (Commands): Use deque.
  1372. (clearQueue): New function.
  1373. * src/DownloadEngine.cc
  1374. (~DownloadEngine): Added deletion of segmentMan.
  1375. (cleanQueue): New function.
  1376. * src/TorrentDownloadEngine.h
  1377. (TorrentDownloadEngine): The implementation was moved to
  1378. TorrentDownloadEngine.cc.
  1379. (~TorrentDownloadEngine): The implementation was moved to
  1380. TorrentDownloadEngine.cc.
  1381. * src/TorrentDownloadEngine.cc
  1382. (~TorrentDownloadEngine): Added deletion of torrentMan.
  1383. * src/main.cc
  1384. (clearRequest): Removed.
  1385. (handler): Added deletion of e.
  1386. (torrentHandler): Added deletion of te.
  1387. (main): Do not share splitter.
  1388. Use Deleter instead of clearRequest.
  1389. Deletion of classes were updated.
  1390. 2006-05-06 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  1391. * src/main.cc (main): Fixed typo.
  1392. * src/message.h: Fixed typo.
  1393. * po/de.po: Added German translation, thanks to Hermann J. Beckers.
  1394. 2006-04-29 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  1395. To add --select-file command-line option:
  1396. * src/Util.cc
  1397. (unfoldRange): New function.
  1398. (getNum): New function.
  1399. (unfoldSubRange): New function
  1400. * src/main.cc
  1401. (showUsage): Added help message.
  1402. (main): Added --select-file command-line option. Updated the layout of
  1403. file listing.
  1404. * src/common.h
  1405. (Integers): New definition.
  1406. * src/SocketCore.cc
  1407. (writeData): Removed timeout argument.
  1408. (readData): Removed timeout argument.
  1409. (peekData): Removed timeout argument.
  1410. * src/Socket.cc
  1411. (writeData): Removed timeout argument.
  1412. (readData): Removed timeout argument.
  1413. (peekData): Removed timeout argument.
  1414. * Release 0.4.1
  1415. 2006-04-28 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  1416. To deploy upload rate based choking algorithm:
  1417. * src/PeerInteractionCommand.cc
  1418. (PeerInteractionCommand): Add peer to TorrentMan::activePeers to track
  1419. peer currently used.
  1420. (decideChoking): Deleted the choke/unchoke decision algorithm when
  1421. download completes. Simplified.
  1422. (receiveMessage): Updated.
  1423. * src/TorrentMan.h
  1424. (activePeers): New variable.
  1425. (addActivePeer): New function.
  1426. (getActivePeers): New function.
  1427. (deleteActivePeer): New function.
  1428. * src/TorrentMan.cc
  1429. (addPeer): deleteOldErrorPeers is moved to the begining of the function
  1430. * src/PeerAbstractCommand.cc
  1431. (onAbort): Use peer->resetStatus().
  1432. * src/main.cc
  1433. (PeerChokeCommand.h): Included.
  1434. (main): Added the instance of ChokingCommand to the command queue.
  1435. * src/Peer.h
  1436. (amChoking): Renamed from amChocking
  1437. (chokingRequired): New variable.
  1438. (optUnchoking): New variable.
  1439. (deltaUpload): New variable.
  1440. (deltaDownload): New variable.
  1441. (addDeltaUpload): New function.
  1442. (resetDeltaUpload): New function.
  1443. (addDeltaDownload): New function.
  1444. (resetDeltaDownload): New function.
  1445. (addPeerUpload): Added a call to addDeltaUpload.
  1446. (addPeerDownload): Added a call to addDeltaDownload.
  1447. * src/Peer.cc
  1448. (shouldBeChoking): Renamed from shouldChoke.
  1449. (resetStatus): New function.
  1450. * src/PeerChokeCommand.h: New class.
  1451. * src/PeerChokeCommand.cc: New class.
  1452. To add lazy upload speed limiter:
  1453. * src/TorrentConsoleDownloadEngine.h: Moved the variables for
  1454. statistics calculation to TorrentDownloadEngine.
  1455. * src/TorrentConsoleDownloadEngine.cc
  1456. (sendStatistics): Renamed from printStatistics.
  1457. (initStatistics): Removed. Moved to TorrentDownloadEngine.
  1458. (calculateSpeed): Removed. Moved to TorrentDownloadEngine.
  1459. (calculateStatistics): Removed. Moved to TorrentDownloadEngine.
  1460. * src/TorrentDownloadEngine.h: Added the variables for statistics
  1461. calculation.
  1462. (sendStatistics): New function as pure virtual function.
  1463. (getUploadSpeed): New function.
  1464. * src/TorrentDownloadEngine.cc
  1465. (initStatistics): New function.
  1466. (calculateSpeed): New function.
  1467. (calculateStatistics): New function.
  1468. * src/SendMessageQueue.h
  1469. (uploadLength): New variable.
  1470. (send): Added an argument.
  1471. (setUploadLimit): New function.
  1472. (getUploadLimit): New function.
  1473. * src/SendMessageQueue.cc
  1474. (send): Added upload speed limiter.
  1475. * src/prefs.h
  1476. (PREF_UPLOAD_LIMIT): New definition.
  1477. * src/PeerInteractionCommand.cc
  1478. (PeerInteractionCommand): Set upload speed limit to sendMessageQueue.
  1479. * src/main.cc
  1480. (main): Added --upload-limit option
  1481. For bug fixes:
  1482. * src/main.cc
  1483. (showUsage): Corrected --listen-port help
  1484. Other changes:
  1485. * src/TorrentMan.cc
  1486. (getPeer): Return nullPeer if connection is grather than
  1487. MAX_PEER_UPDATE(15) in order to leave space for incoming peers.
  1488. 2006-04-21 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  1489. To add some useful information to the exception message:
  1490. * src/SocketCore.cc : Updated messages.
  1491. * src/SegmentMan.cc :
  1492. * src/TorrentMan.cc : Updated messages.
  1493. * src/MultiDiskWriter.cc : Updated messages.
  1494. * src/Util.cc : Updated messages.
  1495. * src/AbstractDiskWriter.cc : Updated messages.
  1496. * src/PreAllocationDiskWriter.cc : Updated messages.
  1497. * src/message.cc : Added new messages. Updated some messages.
  1498. * src/TrackerWatcherCommand.h (MIN_PEERS): New definition.
  1499. * src/TrackerWatcherCommand.cc (execute): Use MIN_PEERS.
  1500. Updated threshold from 30 to 15.
  1501. * src/AbstractDiskWriter.h (filename): New variable.
  1502. * src/AbstractDiskWriter.cc (openExistingFile): Assigned filename.
  1503. (createFile): Assigned filename.
  1504. * src/main.cc: Updated the help message for http-auth-scheme.
  1505. * Release 0.4.0
  1506. 2006-04-20 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  1507. To add TrackerUpdateCommand with which replaces
  1508. CompactTrackerResponseProcessor:
  1509. * src/TrackerWatcherCommand.h (req): Removed.
  1510. * src/TrackerWatcherCommand.cc (execute): Send a request to tracker
  1511. if the number of peer connections are less than 30.
  1512. * src/ByteArrayDiskWriter.h (readData): Implemented.
  1513. * src/SegmentMan.h (diskWriter): New function.
  1514. * src/SegmentMan.cc (init): Added a call to diskWriter->closeFile()
  1515. * src/main.cc : Removed #include "CompactTrackerResponseProcessor.h"
  1516. (main): Use TrackerUpdateCommand.
  1517. * src/TorrentMan.h (CompactTrackerResponseProcessor): Removed.
  1518. (req): New variable.
  1519. (setTrackerResponseProcessor): Removed.
  1520. (getTrackerResponseProcessor): Removed.
  1521. (processTrackerResponse): Removed.
  1522. * src/DownloadEngine.h (diskWriter): Removed.
  1523. * src/TorrentDownloadEngine.cc (afterEachIteration): Removed a call
  1524. to torrentMan->processTrackerResponse().
  1525. To add Util::expandBuffer:
  1526. * src/ByteArrayDiskWriter.h (expandBuffer): Removed.
  1527. * src/ByteArrayDiskWriter.cc (writeData): Use Util::expandBuffer().
  1528. * src/Util.h (expandBuffer): New function.
  1529. To fix the bug that causes segmentation fault when "-l ." is specified
  1530. in command-line option:
  1531. * src/SimpleLogger.h (SimpleLogger): Removed "filename" argument.
  1532. (openFile): New function.
  1533. (closeFile): New function.
  1534. * src/SimpleLogger.cc (SimpleLogger): Removed fopen.
  1535. (~SimpleLogger): Call closeFile();
  1536. * src/LogFactory.cc (getInstance): Added a call to slogger->openFile().
  1537. * src/main.cc (main): Added a check to see logger is configured
  1538. properly.
  1539. To enable HTTP authentication without specifying "--http-auth-scheme"
  1540. * src/prefs.h (PREF_HTTP_AUTH_ENABLED): New definition.
  1541. * src/HttpConnection.cc (createRequest): Send Authorization header
  1542. if PREF_HTTP_AUTH_ENABLED == V_TRUE.
  1543. * src/main.cc (main): Preset PREF_HTTP_AUTH_SCHEME to V_TRUE
  1544. If "--http-user" is specified, set PREF_HTTP_AUTH_ENABLED to V_TRUE
  1545. * src/Peer.cc (shouldChoke): Updated algorithm.
  1546. * src/message.h (EX_AUTH_FAILED): New definition.
  1547. (EX_FILE_OPEN): New definition.
  1548. * src/HttpResponseCommand.cc (checkResponse): Throw DlAbortEx
  1549. if status == 401.
  1550. (handleDefaultEncoding): Added a call to diskWriter->initAndOpenFile()
  1551. if req->isTorrent == true.
  1552. * src/main.cc (handler): Removed the check to see e->diskWriter != NULL
  1553. (torrentHandler): Removed the check to see diskAdaptor != NULL.
  1554. * src/AbstractDiskWriter.cc (openExistingFile): Updated messsage.
  1555. (createFile): Updated message.
  1556. 2006-04-19 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  1557. To add a readout of estimated remaining time to normal HTTP/FTP
  1558. downloads:
  1559. * src/ConsoleDownloadEngine.h (startup): New variable.
  1560. (startupLength): New variable.
  1561. (isStartupLengthSet): New variable.
  1562. (avgSpeed): New variable.
  1563. (eta): New variable.
  1564. * src/ConsoleDownloadEngine.cc (sendStatistics): Added a readout of
  1565. estimated remaining time.
  1566. (initStatistics): Initialized newly added variables.
  1567. (calculateStatistics): Calculate average speed and estimated remaining
  1568. time.
  1569. To decouple TorrentDownloadEngine from HttpResponseCommand:
  1570. * src/TrackerDownloadCommand.h: Removed.
  1571. * src/TrackerDownloadCommand.cc: Removed.
  1572. * src/TrackerInitCommand.h: Removed.
  1573. * src/TrackerInitCommand.cc: Removed.
  1574. * src/TrackerUpdateCommand.h: Removed.
  1575. * src/TrackerUpdateCommand.cc: Removed.
  1576. * src/TrackerWatcherCommand.cc (execute): The construction of request
  1577. url written in TrackerInitCommand was moved here. Do not create
  1578. tracker request command if torrentMan->trackers != 0.
  1579. * src/CompactTrackerResponseProcessor.h: New class.
  1580. * src/CompactTrackerResponseProcessor.cc: New class.
  1581. * src/message.h (MSG_TRACKER_WARNING_MESSAGE): Updated.
  1582. * src/HttpResponseCommand.cc (createHttpDownloadCommand):
  1583. Decoupled TorrentDownloadEngine from this.
  1584. * src/SegmentMan.h (init): New function.
  1585. * src/SegmentMan.cc (init): New function.
  1586. * src/TorrentMan.h (responseProcessor): New variable.
  1587. (trackers): New variable.
  1588. (setTrackerResponseProcessor): New function.
  1589. (getTrackerResponseProcessor): New function.
  1590. (processTrackerResponse): New function.
  1591. * src/TorrentMan.cc (Constructor): Initialized new variable trackers.
  1592. (processTrackerResponse): New function.
  1593. * src/main.cc (main): Use ByteArrayDiskWriter and
  1594. CompactTrackerResponseProcessor.
  1595. * src/TorrentDownloadEngine.cc (afterEachIteration): Call torrentMan->
  1596. processTrackerResponse().
  1597. * src/TorrentConsoleDownloadEngine.cc (printStatistics): Updated a
  1598. readout.
  1599. * src/TorrentDownloadEngine.cc (afterEachIteration): Added log message
  1600. which indicates download has completed.
  1601. * src/AbstractDiskWriter.cc (Destructor): fd >= 0, not fd >0
  1602. (closeFile): fd >= 0, not fd > 0
  1603. * src/main.cc (main): Added short cut for show-files.
  1604. Added short cut for torrent-file.
  1605. Added new command-line option listen-port.
  1606. Updated i18n messages.
  1607. 2006-04-18 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  1608. To add LogFactory which creates singleton logger:
  1609. * src/LogFactory.h: New class.
  1610. * src/LogFactory.cc: New class.
  1611. * src/Command.h (logger): New variable.
  1612. (Constructor): Use LogFactory.
  1613. * src/AbstractCommand.cc: Use Command::logger
  1614. * src/PeerConnection.cc (Constructor): Deleted the argument logger.
  1615. Use LogFactory.
  1616. * src/SegmentSplitter.h : Made logger protected.
  1617. * src/SegmentSplitter.cc (Constructor): Use LogFactory.
  1618. * src/SegmentMan.cc (Constructor): Use LogFactory.
  1619. * src/DownloadEngine.h : Made logger protected.
  1620. * src/DownloadEngine.cc (Constructor): Use LogFactory.
  1621. * src/PeerInteractionCommand.cc : Use Command::logger.
  1622. * src/HttpResponseCommand.cc : Use Command::logger.
  1623. * src/SegmentMan.h : Made logger private.
  1624. * src/TorrentMan.h : Made logger private.
  1625. * src/TorrentMan.cc : Use LogFactory.
  1626. * src/FtpNegotiateCommand.cc : Use Command::logger.
  1627. * src/HttpConnection.h (Constructor): Deleted the argument logger.
  1628. * src/HttpConnection.cc (Constructor): Deleted the argument logger.
  1629. Use LogFactory.
  1630. * src/FtpConnection.h (Constructor): Deleted the argument logger.
  1631. * src/FtpConnection.cc (Constructor): Deleted the argument logger.
  1632. Use LogFactory.
  1633. * src/DownloadCommand.cc : Use Command::logger.
  1634. * src/PeerAbstractCommand.cc : Use Command::logger.
  1635. * src/PeerListenCommand.cc : Use Command::logger.
  1636. * src/PeerInitiateConnectionCommand.cc : Use Command::logger.
  1637. * src/HttpInitiateConnectionCommand.cc : Use Command::logger.
  1638. * src/FtpInitiateConnectionCommand.cc : Use Command::logger.
  1639. * src/TrackerWatcherCommand.cc : Use Command::logger.
  1640. * src/TrackerUpdateCommand.cc : Use Command::logger.
  1641. * src/TrackerDownloadCommand.cc : Use Command::logger.
  1642. * src/RequestSlotMan.cc (Constructor): Deleted the argument logger.
  1643. Use LogFactory.
  1644. * src/SendMessageQueue.h (Constructor): Deleted the argument logger.
  1645. * src/SendMessageQueue.cc (Constructor): Deleted the argument logger.
  1646. Use LogFactory.
  1647. * src/main.cc (main): Use LogFactory.
  1648. * src/DiskAdaptor.h (logger): New variable.
  1649. * src/DiskAdaptor.cc (Constructor): Use LogFactory.
  1650. * src/CopyDiskAdaptor.cc (fixFilename): Added a log message.
  1651. 2006-04-17 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  1652. * src/TrackerInitCommand.cc (TrackerInitCommand): Added a "key"
  1653. parameter to a tracker request.
  1654. * src/TorrentMan.cc (readFileEntryFromMetaInfoFile): Bug fix.
  1655. * src/TrackerWatcherCommand.cc (execute): Call req->resetTryCount().
  1656. * src/main.cc (setSignalHander): New function.
  1657. (main): Added a handler for SIGTERM.
  1658. (handler): Updated message.
  1659. (torrentHandler): Updated message.
  1660. 2006-04-16 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  1661. * src/TorrentConsoleDownloadEngine.cc
  1662. (onPartialDownloadingCompletes): Renamed as
  1663. onSelectiveDownloadingCompletes.
  1664. (onSelectiveDownloadingCompletes): Updated message.
  1665. To add DiskAdaptor which abstract DiskWriter family:
  1666. * src/PeerConnection.cc: Use diskAdaptor instead of diskWriter.
  1667. * src/PeerInteractionCommand.cc: Use diskAdaptor instead of diskWriter.
  1668. * src/BitfieldMan.cc (isAllBitSet): bug fix.
  1669. * src/TorrentMan.cc : Included CopyDiskAdaptor.h, DirectDiskAdaptor.h,
  1670. MultiDiskAdaptor.h.
  1671. (readFileEntry): Changed its arguments.
  1672. (setup): setupDiskWriter is merged into this function.
  1673. (setupDiskWriter): Removed.
  1674. (setFileFilter): New function.
  1675. (readFileEntryFromMetaInfoFile): Updated according to the changes
  1676. made in readFileEntry.
  1677. (getFilePath): Removed.
  1678. (getTempFilePath): Removed.
  1679. (getSegmentFilePath): Updated due to the removal of getFilePath.
  1680. (fixFilename): Removed.
  1681. (copySingleFile): Removed.
  1682. (splitMultiFile): Removed.
  1683. (deleteTempFile): Removed.
  1684. (setFileEntriesToDownload): Removed.
  1685. (isPartialDownloadingMode): Renamed as isSelectiveDownloadingMode.
  1686. (isSelectiveDownloadingMode): New function.
  1687. (setAllMultiFileRequestedState): Removed.
  1688. (finishPartialDownloadingMode): Renamed as
  1689. finishSelectiveDownloadingMode.
  1690. (finishSelectiveDownloadingMode): New function.
  1691. (getPartialTotalLength): Renamed as getSelectedTotalLength.
  1692. (getSelectedTotalLength): New function.
  1693. (onDownloadComplete): Use diskAdaptor.
  1694. * src/MultiDiskWriter.cc (Constructor): Added the argument pieceLength
  1695. (Range): Removed.
  1696. (setMultiFileEntries): Renamed as setFileEntries.
  1697. (setFileEntries): New function.
  1698. * src/MultiDiskWriter.h [DiskWriterEntry](enabled): Removed.
  1699. (pieceLength): New variable.
  1700. * src/main.cc (printDownloadCompeleteMessage): New function.
  1701. (torrentHandler): Use diskAdaptor instead of diskWriter.
  1702. (main): Renamed torrent-show-files to show-files.
  1703. Rewritten file contents listing.
  1704. * src/TorrentMan.h (FileEntry): Removed.
  1705. (multiFileTopDir): Removed.
  1706. (multiFileEntries): Removed.
  1707. (diskWriter): Removed.
  1708. (diskAdaptor): New variable.
  1709. * src/DefaultDiskWriter.h (totalLength): New variable.
  1710. * src/DefaultDiskWriter.cc (initAndOpenFile): Added ftruncate.
  1711. * src/TorrentDownloadEngine.cc (onEndOfRun): Use diskAdaptor instead of
  1712. diskWriter.
  1713. * src/TorrentConsoleDownloadEngine.h
  1714. (partialDownloadLengthDiff): Renamed as selectedDownloadLengthDiff.
  1715. (partialTotalLength): Renamed as selectedTotalLength.
  1716. * src/AbstractDiskWriter.cc (openFile): If file exists, call
  1717. openExistingFile, otherwise call initAndOpenFile.
  1718. (closeFile): fd > 0, not fd != 0.
  1719. * src/DirectDiskAdaptor.h: New class.
  1720. * src/DirectDiskAdaptor.cc: New class.
  1721. * src/MultiDiskAdaptor.h: New class.
  1722. * src/MultiDiskAdaptor.cc: New class.
  1723. * src/CopyDiskAdaptor.h: New class.
  1724. * src/CopyDiskAdaptor.cc: New class.
  1725. * src/DiskAdaptor.h: New class.
  1726. * src/DiskAdaptor.cc: New class.
  1727. * src/prefs.h (PREF_TORRENT_SHOW_FILES): Renamed as PREF_SHOW_FILES
  1728. (PREF_SHOW_FILES): New definition.
  1729. 2006-04-12 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  1730. To add the ability to download multi torrent into respective files
  1731. directly:
  1732. * src/DiskWriter.h (openFile): New function.
  1733. (seek): Removed.
  1734. * src/MultiDiskWriter.h: New class.
  1735. * src/MultiDiskWriter.cc: New class.
  1736. * src/AbstractDiskWriter.h (seek): Changed its scope from public to
  1737. protected.
  1738. (openFile): New function.
  1739. * src/AbstractDiskWriter.cc (openFile): New function.
  1740. * src/prefs.h (V_FALSE): New definition.
  1741. (PREF_DIRECT_FILE_MAPPING): New definition.
  1742. * src/TorrentMan.h (setupDiskWriter): New function.
  1743. (setAllMultiFileRequestedState): New function.
  1744. (onDownloadComplete): New function.
  1745. * src/TorrentMan.cc : Included MultiDiskWriter.h
  1746. (setupDiskWriter): New function.
  1747. (getFilePath): Updated.
  1748. (getTempFilePath): Updated.
  1749. (getSegmentFilePath): Updated.
  1750. (fixFilename): Updated.
  1751. (deleteTempFile): Updated.
  1752. (setAllMultiFileRequestedState): New function.
  1753. (setFileEntriesToDownload): Use setAllMultiFileRequestedState().
  1754. (finishPartialDownloadingMode): Reset requested flags.
  1755. (onDownloadComplete): New function.
  1756. * src/main.cc: Added --direct-file-mapping option.
  1757. Use TorrentMan::setupDiskWriter().
  1758. * src/TorrentDownloadEngine.cc (afterEachIteration): Use TorrentMan::
  1759. onDownloadComplete().
  1760. To fix ETA bug:
  1761. * src/Util.h (difftvsec): New function.
  1762. * src/Util.cc (difftvsec): New function.
  1763. * src/TorrentConsoleDownloadEngine.cc (calculateSpeed): Use int for the
  1764. type of "elapsed" instead of long long int.
  1765. (calculateStatistics): Use Util::difftvsec instead of Util::difftv.
  1766. The updates of statistics takes place every 1 seconds.
  1767. * src/TorrentConsoleDownloadEngine.h (lastElapsed): Changed its type.
  1768. (calculateSpeed): Changed its argument signature.
  1769. * src/PeerMessage.cc (toString): Fixed message.
  1770. 2006-04-06 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  1771. To print ETA:
  1772. * src/TorrentDownloadEngine.cc (afterEachIteration): Added download
  1773. completion handling when dealing with
  1774. TorrentMan::isPartialDownloadingMode() == true.
  1775. * src/TorrentDownloadEngine.h (onPartialDownloadingCompletes):
  1776. New function.
  1777. * src/TorrentConsoleDownloadEngine.h (startup): New variable.
  1778. (sessionDownloadLength): New variable.
  1779. (avgSpeed): New variable.
  1780. (eta): New variable.
  1781. * src/TorrentConsoleDownloadEngine.cc (initStatistics): Initialized
  1782. new variables: eta, avgSpeed, startup.
  1783. (calculateSpeed): Calculate average speed and ETA.
  1784. (printStatistics): Added ETA.
  1785. * src/Util.h (secfmt): New function.
  1786. * src/Util.cc (secfmt): New function.
  1787. 2006-04-05 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  1788. To detect "keep alive" flooding:
  1789. * src/PeerInteractionCommand.h (keepAliveCount): New variable
  1790. * src/PeerInteractionCommand.cc (Constructor): Initialized new
  1791. variable: keepAliveCount.
  1792. (detectMessageFlooding): Added "keep alive" flooding detection.
  1793. (receiveMessage): Increase keepAliveCount when "keep alive" message
  1794. received.
  1795. To add the ability to download only specified files in multi-file
  1796. torrent:
  1797. * src/BitfieldMan.h (filterBitfield): New variable.
  1798. (filterEnabled): New variable.
  1799. (setFilterBit): New function.
  1800. (enableFilter): New function.
  1801. (disableFilter): New function.
  1802. (isFilterEnabled): New function.
  1803. (getFilteredTotalLength): New function.
  1804. (getCompletedLength): New function.
  1805. * src/BitfieldMan.cc (Constructor): Initialized new variable:
  1806. filterBitfield, filterEnabled.
  1807. (CopyConstructor): Added filterBitfield and filterEnabled.
  1808. (operator==): Added filterBitfield and filterEnabled.
  1809. (Destructor): Added filterBitfield.
  1810. (getMissingIndex): Use filterBitfield.
  1811. (getMissingUnusedIndex): Use filterBitfield.
  1812. (getFirstMissingUnusedIndex): Use filterBitfield.
  1813. (getFirstMissingUnusedIndex): Use filterBitfield.
  1814. (getAllMissingIndexes): Use filterBitfield.
  1815. (countMissingBlock): Use filterBitfield.
  1816. (countBlock): Use filterBitfield.
  1817. (setBitInternal): Added new argument on.
  1818. (setUseBit): Use setBitInternal.
  1819. (unsetUseBit): Use setBitInternal.
  1820. (setBit): Use setBitInternal.
  1821. (unsetBit): Use setBitInternal.
  1822. (isAllBitSet): Use filterBitfield.
  1823. (setFilterBit): New function.
  1824. (addFilter): New function.
  1825. (enableFilter): New function.
  1826. (disableFilter): New function.
  1827. (clearFilter): New function.
  1828. (isFilterEnabled): New function.
  1829. (getFilteredTotalLength): New function.
  1830. (getCompletedLength): New function.
  1831. * src/TorrentMan.h [FileEntry](Constructor): Updated signature.
  1832. Initalized newly added variables.
  1833. [FileEntry](offset): New variable.
  1834. [FileEntry](extracted): New variable.
  1835. [FileEntry](requested): New variable.
  1836. (readFileEntry): New function.
  1837. (option): New variable.
  1838. (splitMultiFile): Removed const qualifier.
  1839. (fixFilename): Removed const qualifier.
  1840. (readFileEntryFromMetaInfoFile): New function.
  1841. (finishPartialDownloadingMode): New function.
  1842. (isPartialDownloadingMode): New function.
  1843. (setFileEntriesToDownload): New function.
  1844. (getCompletedLength): New function.
  1845. (getPartialTotalLength): New function.
  1846. * src/TorrentMan.cc (readFileEntry): New function.
  1847. (setup): Use readFileEntry. If no-preallocation option is specified,
  1848. use DefaultDiskWriter.
  1849. (readFileEntryFromMetaInfoFile): New function.
  1850. (fixFilename): Removed const qualifier.
  1851. (splitMultiFile): Removed const qualifier.
  1852. (setFileEntriesToDownload): New function.
  1853. (isPartialDownloadingMode): New function.
  1854. (finishPartialDownloadingMode): New function.
  1855. (getCompletedLength): New function.
  1856. (getPartialTotalLength): New function.
  1857. * src/TorrentConsoleDownloadEngine.h (partialDownloadLengthDiff):
  1858. New variable.
  1859. (partialTotalLength): New variable.
  1860. (downloadLength): New variable.
  1861. (totalLength): New variable.
  1862. * src/TorrentConsoleDownloadEngine.cc (onPartialDownloadingCompletes):
  1863. Added log.
  1864. (initStatistics): Initialized new variables: partialDownloadLengthDiff,
  1865. partialTotalLength, downloadLength, totalLength.
  1866. (calculate): Calculate downloadLength and totalLength.
  1867. * src/prefs.h :New definition PREF_NO_PREALLOCATION
  1868. * src/main.cc (addCommand): Changed argument signature.
  1869. (main): Added new variable: args. Added new option "torrent-show-files"
  1870. "no-preallocation". Usage is not updated yet.
  1871. 2006-04-02 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  1872. * src/PeerMessage.cc (setBitfield): Fixed invalid memory de-allocation.
  1873. 2006-04-01 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  1874. Attempt to add the ability to listing file entries in a .torrent file.
  1875. This feature is not yet complete.
  1876. * src/prefs.h (PREF_TORRENT_SHOW_FILES): New definition
  1877. * src/TorrentMan.cc (getMultiFileEntries): New function.
  1878. (getName): New function.
  1879. * src/TorrentMan.h (getMultiFileEntries): New function.
  1880. (getName): New function.
  1881. * src/main.cc (main): Use above 2 funtion.
  1882. * Release 0.3.2
  1883. 2006-03-31 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  1884. * src/PeerInteractionCommand.cc (checkInactiveConnection): New function
  1885. (detectMessageFlooding): Updated threshold value.
  1886. (checkLongTimePeerChoking): Updated timeout value.
  1887. (getNewPieceAndSendInterest): Added debug log.
  1888. * src/PeerInteractionCommand.h (checkInactiveConnection): New function
  1889. * src/TorrentMan.cc (deleteOldErrorPeers): Updated.
  1890. (getPeer): Updated.
  1891. * src/TorrentMan.h: Added MAX_PEER_ERROR.
  1892. * src/PeerAbstractCommand.cc (onAbort): Increment error counter.
  1893. * src/PeerListenCommand.cc (execute): Close connection if incoming peer
  1894. is localhost.
  1895. * src/main.cc (main): Updated PREF_PEER_CONNECTION_TIMEOUT to 60.
  1896. * src/PendingMessage.cc (processMessage): Not to send piece message
  1897. if peer is not interested in the pieces localhost has.
  1898. * src/Peer.cc (shouldChoke): Updated.
  1899. * src/SendMessageQueue.cc (cancelAllRequest): Fixed.
  1900. * src/Util.cc (isPowerOf): New function.
  1901. * src/Util.h (isPowerOf): New function.
  1902. * src/PeerMessageUtil.cc (checkLength): Added a check for length
  1903. whether or not it is power of 2.
  1904. 2006-03-28 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  1905. Added new class SendMessageQueue that includes PendingMessages and
  1906. RequestSlotMan.
  1907. * src/SendMessageQueue.h: New class.
  1908. * src/SendMessageQueue.cc: New class.
  1909. * src/PendingMessage.h: Added new member variable blockIndex and its
  1910. accessors.
  1911. (createRequestMessage): Updated.
  1912. * src/PendingMessage.cc (createRequestMessage): Updated.
  1913. * src/PeerInteractionCommand.cc (executeInternal): Updated with
  1914. SendMessageQueue.
  1915. (checkLongTimePeerChoking): Updated with SendMessageQueue.
  1916. (receiveMessage): Updated with SendMessageQueue.
  1917. (deletePendingPieceMessage): Removed.
  1918. (getNewPieceAndSendInterest): Updated with SendMessageQueue.
  1919. (sendInterest): Updated with SendMessageQueue.
  1920. (createRequestPendingMessage): Updated with SendMessageQueue.
  1921. (sendMessages): Updated with SendMessageQueue.
  1922. (onAbort): Updated with SendMessageQueue.
  1923. (keepAlive): Updated with SendMessageQueue.
  1924. (beforeSocketCheck): Updated SendMessageQueue.
  1925. * src/PeerInteractionCommand (sendMessages): Shuffle
  1926. missingBLockIndexes before using it.
  1927. Added its own timeout for peer connection.
  1928. * src/PeerAbstractCommand.h: Added member variable timeout and its
  1929. setter.
  1930. * src/prefs.h: Added PREF_PEER_CONNECTION_TIMEOUT.
  1931. * src/PeerInteractionCommand.cc (PeerInteractionCommand):
  1932. Added setTimeout() call.
  1933. (executeInternal): Added setTimeout() call.
  1934. * src/PeerAbstractCommand.cc (PeerAbstractCommand):
  1935. Added timeout.
  1936. (isTimeoutDetected): Updated.
  1937. * src/main.cc (main): Added PREF_PEER_CONNECTION_TIMEOUT entry to
  1938. option.
  1939. Added *simple* message flooding checker.
  1940. * src/PeerInteractionCommand.cc (executeInternal):
  1941. Added detectMessageFlooding() call.
  1942. (detectMessageFlooding): New function.
  1943. (receiveMessage): Count up CHOKE, UNCHOKE, HAVE message.
  1944. (beforeSocketCheck): Added detectMessageFlooding() call.
  1945. * src/PeerInteractionCommand.h: Added sendMessageQueue,
  1946. chokeUnchokeCount, haveCount, detectMessageFlooding().
  1947. Removed deletePendingPieceMessage(), getRequestSlot(),
  1948. deleteRequestSlot(), deleteAllRequestSlot().
  1949. * src/PeerInteractionCommand.cc (beforeSocketCheck):
  1950. Added checkLongTimePeerChoking() call.
  1951. * src/RequestSlotMan.h: Renamed deleteTimeoutRequestSlot().
  1952. * src/TorrentMan.cc (addPeer): Delete at most MAX_PEER_LIST_SIZE peers
  1953. if duplicate == false.
  1954. The parameter "uploaded" and "downloaded" in the tracker request are
  1955. the size since the client sent the "started" event to the tracker.
  1956. * src/TorrentMan.cc (setup): Assigned saved downloaded Size and
  1957. uploaded size to preDownloadedSize, preUploadedSize respectively.
  1958. * src/TorrentMan.h: Added preDownloadedSize, preUploadedSize,
  1959. getSessionDownloadedSize(), getSessionUploadedSize().
  1960. * src/TrackerInitCommand.cc (execute): Use getSessionDownloadedSize(),
  1961. getSessionUploadedSize() instead of getDownloadedSize(),
  1962. getUploadedSize().
  1963. * src/PendingMessage.cc (processMessage): Do not send request message
  1964. if the peer is choking the client.
  1965. * src/TrackerUpdateCommand.cc (execute): Check wtheher minInterval is
  1966. less than interval.
  1967. 2006-03-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  1968. * configure.in: Added gnutls support. Added several CPP macros.
  1969. * m4/openssl.m4: Added.
  1970. * src/SocketCore.{h,cc}: Drop const quarifier from writeData(),
  1971. readData(), peekData(). Added gnutls support.
  1972. * src/HttpDownloadCommand.cc: Removed SleepCommand.h
  1973. * src/TrackerWatcherCommand.{h,cc}: Added. This command creates
  1974. TrackerInitCommand periodicaly(TorrentMan::minInterval).
  1975. * src/TorrentMan.cc: Remove downloadedSize == 0 check from save().
  1976. Instead, added a check for whether setup method has executed
  1977. successfully.
  1978. * src/TorrentMan.h: Added member vaiable setupComplete. Updated
  1979. DEFAULT_ANNOUNCE_INTERVAL and DEFAULT_ANNOUNCE_MIN_INTERVAL to 300.
  1980. * src/Makefile.am: Updated.
  1981. * src/messageDigest.h: Added. This is a macro calculating SHA1 digest
  1982. using whether OpenSSL or gcrypt, depending on the result of configure
  1983. script.
  1984. * src/ShaVisitor.{h,cc}: Removed direct dependency on OpenSSL by using
  1985. messageDigest.h.
  1986. * src/TorrentAutoSaveCommand.h: Removed unused variable cuid.
  1987. * src/PeerListenCommand.cc: Added log about port binded successfully.
  1988. Fixed memory leak.
  1989. * src/main.cc: Added gnutls support. Replaced LIB_SSL with
  1990. ENABLE_BITTORRENT where they are not related to OpenSSL but BitTorrent.
  1991. Removed instantiation of TrackerInitCommand. Instead,
  1992. TrackerWatcherCommand is instantiated and pushed to the command queue.
  1993. * src/InitiateConnectionCommandFactory.cc: Replaced HAVE_LIBSSL with
  1994. ENABLE_SSL.
  1995. * src/Request.cc: Replaced HAVE_LIBSSL with ENABLE_SSL.
  1996. * src/RequestSlotMan.cc (deleteCompletedRequestSlot):
  1997. If a piece is already acquired by another command, delete the request
  1998. slots for the piece.
  1999. * src/TrackerUpdateCommand.cc (execute):
  2000. Changed log level of MSG_TRACKER_WARNING_MESSAGE from info to warn.
  2001. Added a check whether peer list is null.
  2002. Fixed the bug that causes sending completed event to the tracker
  2003. several times.
  2004. * src/TrackerInitCommand.cc (execute):
  2005. Fixed the bug that causes sending completed event to the tracker
  2006. several times.
  2007. * src/AbstractDiskWriter.{h,cc}: Removed direct dependency on OpenSSL
  2008. by using messageDigest.h.
  2009. 2006-03-26 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2010. * PeerConnection.cc: Replaced log message "keep-alive" with
  2011. "keep alive".
  2012. * PeerInteractionCommand.{h,cc}: Close connection if peer is choking
  2013. localhost long time.
  2014. * TorrentMan.cc: When adding new peer with duplicate = true, if the
  2015. number of peer list is equal to or grater than MAX_PEER_LIST, delete
  2016. at most 100 failure entry from the list. If with duplicate = false,
  2017. MAX_PEER_LIST is not checked.
  2018. * PeerListenCommand.cc: Fixed the argument order of log message.
  2019. 2006-03-25 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2020. * Logger.h: Moved enum LEVEL from SimpleLogger.h to here.
  2021. Added warn().
  2022. * SimpleLogger.h: Moved enum LEVEL to Logger.h.
  2023. Implemented warn().
  2024. Defined 2 macros(WRITE_LOG, WRITE_LOG_EX) to avoid duplicated code.
  2025. 2006-03-24 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2026. * Request.h: Added AFTER_COMPLETED event.
  2027. * TorrentDownloadEngine.cc: Prints "Download complete" message
  2028. instead of downloaded size and progress(%) after download completes.
  2029. * PeerInteractionCommand.cc: After download completes, sends unchoke
  2030. message to the peer if it is interested in what localhost has
  2031. downloaded.
  2032. * TorrentMan.cc: In single-file mode, copy temporary file to the final
  2033. destination instead of just renaming it.
  2034. * TorrentMan.cc: Added deleteTempFile().
  2035. * PeerAbstractCommand.cc: do not stop execution after download
  2036. completes. This makes localhost a seeder.
  2037. * Util.{h,cc}: Added fileCopy().
  2038. * PeerListenCommand.cc: do not stop execution after download completes.
  2039. This makes localhost a seeder.
  2040. * main.cc: Do not call TorrentMan::fixFilename() in torrentHandler.
  2041. Added TorrentMan::deleteTempFile() to torrentHandler.
  2042. Initialized the variable dir as ".".
  2043. * TorrentMan.h: Changed DEFAULT_ANNOUNCE_INTERVAL to 120 seconds.
  2044. Deleted renameSingleFile().
  2045. Added copySingleFile(), deleteTempFile().
  2046. * DownloadEngine.h: Added virtual function afterEachIteration().
  2047. * TorrentDownloadEngine.cc: Move a call to TorrentMan::fixFilename()
  2048. in onEndOfRun() to afterEachIteration().
  2049. In onEndOfRun(), changed if condition to check whether filenameFixed is
  2050. true.
  2051. * Util.cc: Implemented fileCopy() using rangedFileCopy().
  2052. In rangedFileCopy(), added try-catch block to properly close file
  2053. descriptors.
  2054. * TorrentDownloadEngine.cc: Added a member variable filenameFixed.
  2055. Added afterEachIteration(), isFilenameFixed().
  2056. * Peer.cc: Changed choking strategy.
  2057. * PreAllocationDiskWriter.cc: Drop O_DIRECT flag.
  2058. * TrackerInitCommand.cc: Send completed event only once.
  2059. * DownloadEngine.cc: Added a call to afterEachIteration().
  2060. * TrackerUpdateCommand.cc: Do not stop execution after download
  2061. completes.
  2062. * TorrentMan.h: Defined MAX_PEER_UPDATE as 15. aria2 attempts to
  2063. connect the peers at most MAX_PEER_UPDATE when a peer list is
  2064. received from a tracker.
  2065. * TrackerUpdateCommand.cc: Implemented above mentioned behavior.
  2066. Decreased the number of failure peers to delete to 0(just comment out
  2067. the line).
  2068. * Release 0.3.1
  2069. 2006-03-23 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2070. * PeerInteractionCommand.cc: added a call to
  2071. TorrentMan::unadvertisePiece in Destructor.
  2072. * PeerInteractionCommand.cc: make have message sent immediately
  2073. if the size of pending message queue is zero.
  2074. * TorrentMan.cc: set the maximum size of peer list to 250.
  2075. * TorrentMan.h: changed the container type of Peers and UsedPieces
  2076. to deque.
  2077. * Util.cc: fixed rangedFileCopy.
  2078. * AbstractDiskWriter.{h,cc}: moved digest context initialization
  2079. to Constructor. Also, moved digest cleanup to Destructor.
  2080. * MetaFileUtil.cc: fixed memory leak
  2081. * replaced std::vector with std::deque.
  2082. * AbstractCommand.cc: casted timeout value to long long int.
  2083. * ChunkedEncoding.cc: fixed memory leak.
  2084. * PeerInteractionCommand.cc: casted timeout value to long long int.
  2085. * SleepCommand.cc: casted timeout value to long long int.
  2086. * Data.cc: fixed memory leak.
  2087. * Data.cc: fixed toLLInt().
  2088. * BitfieldMan.cc: fixed memory leak.
  2089. * TorrentMan.cc: initialized storeDir to ".".
  2090. * TorrentMan.cc: fixed memory leak.
  2091. * TorrentMan.cc: corrected file paths of splitted files.
  2092. * PeerAbstractCommand.cc: casted timeout to long long int.
  2093. * main.cc: added delete(req) and delete(te->diskWriter).
  2094. * RequestSlot.cc: casted timeout value to long long int.
  2095. * Request.cc: fixed memory leak.
  2096. * PendingMessage.cc: make HAVE messages sent only when peer does not
  2097. have the piece.
  2098. * Peer.{h,cc}: added hasPiece(int index).
  2099. * main.cc: corrected addCommand.
  2100. 2006-03-22 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2101. * BitTorrent protocol support added.
  2102. * Release 0.3.0
  2103. 2006-03-17 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2104. * SocketCore.cc: remove the assignment of addrinfo.ai_addr.
  2105. 2006-03-09 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2106. * ChunkedEncoding.{h,cc}: fixed the bug that if chunk data is binary,
  2107. decoding did not work properly.
  2108. 2006-03-07 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2109. * DownloadEngine.h: included sys/time.h
  2110. * DownloadEngine.cc: remove sys/time.h
  2111. * Makefile.am (SUBDIRS): Add intl.
  2112. * configure.in (AC_CONFIG_FILES): Add intl/Makefile.
  2113. 2006-03-05 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2114. * main.cc: correct help message for --http-auth-scheme.
  2115. * main.cc: changed e-mail address for bug reports.
  2116. * ja.po: added japanese translation.
  2117. 2006-03-04 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2118. * SimpleLogger.cc: flush log file instead of stdout.
  2119. 2006-03-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2120. * main.cc: Fixed command-line option: max-tries
  2121. * HttpResponseCommand.cc: Make the request re-sent only if req->seg.sp
  2122. does not equal to seg.sp.
  2123. * DownloadCommand.cc: If EOF is got from the server and the total size
  2124. of file is not zero, then throw DlRetryEx.
  2125. * main.cc: Set the minium value of min-segment-size to 1024.
  2126. * HttpResponseCommand.cc: Fixed the bug that http segmented downloading
  2127. fails because of a regression since 0.2.0 release.
  2128. 2006-03-02 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2129. * HttpConnection.cc:
  2130. * common.h: defined the user agent name as macro
  2131. * DownloadEngine.{h, cc}:
  2132. * ConsoleDownloadEngine.{h, cc}: Console output message(size, speed)
  2133. is now generated by ConsoleDownloadEngine not by DownloadEngine.
  2134. * main.cc: Download complete/abort message is now generated by main.
  2135. * Makefile.am (SUBDIRS): Add m4.
  2136. (ACLOCAL_AMFLAGS): New variable.
  2137. (EXTRA_DIST): New variable.
  2138. * configure.in (AC_CONFIG_FILES): Add po/Makefile.in,
  2139. * gettext: added gettext functionality
  2140. 2006-03-01 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2141. * AbstractCommand.cc:
  2142. * DownloadCommand.{h, cc}: Aborted downloading commands now properly
  2143. unregister its cuid from SegmentMan.
  2144. * DownloadEngine.cc: .aria2 file was written when a downloading
  2145. failed with errors.
  2146. * HttpConnection.cc: Added "Proxy-Connection" header to proxy request.
  2147. Added "User-Agent" header to CONNECT proxy request.
  2148. Fixed "Proxy-Authorization" header. Now proxy authorization works
  2149. properly.
  2150. * Logger.h:
  2151. * SimpleLogger.{h,cc}: Changed the type of msg to const char*.
  2152. * ChunkedEncoding.cc: Added #include directive for strings.h
  2153. * Release 0.2.1
  2154. 2006-02-28 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2155. * Util.{h,cc}: added startsWith().
  2156. * CookieBox.cc: rewrited criteriaFind() using Util::startsWith() and
  2157. Util::endsWith().
  2158. * SocketCore.cc: struct addrinfo is now zero-initialized.
  2159. * common.h: added #include directive of limit.h.
  2160. * DownloadEngine.cc: added #include directive of sys/time.h and
  2161. algorithm.
  2162. * Exception.h: added #include directive of stdio.h.
  2163. * AbstractCommand.h: added #include directive of sys/time.h.
  2164. * DownloadCommand.h: added #include directive of sys/time.h.
  2165. * *.h: added #include directive of common.h to all base classes.
  2166. subclasses' one was removed.
  2167. * common.h: defined LONG_LONG_MAX and LONG_LONG_MIN if a compiler
  2168. does not define these macros.
  2169. 2006-02-23 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2170. * Release 0.2.0
  2171. * main.cc:
  2172. * HttpInitiateConnectionCommand.{h,cc}:
  2173. * prefs.h:
  2174. * HttpConnection.{h,cc}: added --http-proxy-method option.
  2175. We can now use GET command in http proxy.
  2176. 2006-02-22 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2177. * SplitSlowestSegmentSplitter.{h,cc}: This class provies algorithm
  2178. that splits slowest segment of SegmentMan::commands vector.
  2179. This is the default split algorithm of aria2.
  2180. * SplitFirstSegmentSplitter.{h,cc}: This class provides algorithm
  2181. that splits first segment of SegmentMan::commands vector.
  2182. * SegmentSplitter.{h,cc}: Added. This class provides split algorithm.
  2183. * DownloadCommand.{h,cc}: Added downloading speed calculation.
  2184. * Segment.h:
  2185. * SegmentMan.cc: Added speed field to Segment.h
  2186. * main.cc: -s option now affects all URLs in command-line arguemtns.
  2187. * HttpResponseCommand.cc: Fixed bug that segment file is not loaded.
  2188. * message.h: Change file size related %d to %lld.
  2189. 2006-02-21 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2190. * FtpInitiateConnectionCommand.{h,cc}:
  2191. * FtpNegotiationCommand.{h,cc}:
  2192. * FtpDownloadCommand.{h,cc}:
  2193. * FtpConnection.{h,cc}: Added FTP support
  2194. * SimpleLogger.cc: Log message now includes time information.
  2195. * main.cc: The value of --http-auth-scheme option is chagned from
  2196. 'BASIC' to 'basic'
  2197. * main.cc: Added --timeout command-line option.
  2198. * main.cc: Added --min-segment-size command-line option.
  2199. * main.cc: Added --max-retries command-line option.
  2200. * prefs.h: option string constants are now defined in prefs.h
  2201. 2006-02-19 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2202. * AbstractCommand.cc: Fixed timeout bug in AbstractCommand
  2203. * SegmentMan.cc: Added totalSize entry to .aria2 file. No compatibility
  2204. with version 0.1.0's one.
  2205. 2006-02-18 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2206. * configure.in: Added --enable-ssl option to configure script.
  2207. * HttpConnection.cc: Make Request-URI an absolute path. Some servers
  2208. cannot permit absoluteURI as Request-URI.
  2209. * HttpConnection.cc: Added Referer support.
  2210. * main.cc: Added referer command-line option.
  2211. * main.cc: Added rety-wait command-line option.
  2212. * Exception.h: Fixed formating bug in Exception::setMsg()
  2213. * SocketCore.{h,cc}:
  2214. * Socket.{h, cc}:
  2215. * Request.cc:
  2216. * InitiateConnectionCommandFactory.cc:
  2217. * HttpRequestCommand.cc: Added HTTPS support.
  2218. * SocketCore.{h,cc}: Added SocketCore. Socket becomes a handle class
  2219. for SocketCore.
  2220. * ChunkedEncoding.cc: Fixed bug in ChunkedEncoding: expanding buffer
  2221. size is wrong
  2222. * DownloadCommand.cc: Fixed bug in DownloadCommand: In Chunked
  2223. Encoding, it wrongly adds to Segment.ds buff length from the socket.
  2224. 2006-02-17 Tatsuhiro Tsujikawa <tsujikawa at rednoah dot com>
  2225. * Release 0.1.0