ChangeLog 89 KB

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