ChangeLog 88 KB

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