ChangeLog 116 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321
  1. 2006-08-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2. * po/ru.po: Azamat sent me Russian translation.
  3. * src/FtpNegotiateCommand.cc
  4. (recvGreeting): Call disableWriteCheckSocket just after
  5. socket->setBlockingMode(). This avoids unnecessary CPU-hog loop.
  6. Rename Time.h to TimeA2.h to avoid compilation ploblem on
  7. case-insesitive filesystem(BUG#1531057).
  8. * src/Time.h: Renamed as TimeA2.h.
  9. * src/Time.cc: Renamed as TimeA2.cc.
  10. * src/TimeA2.h: New class.
  11. * src/TimeA2.cc: New class.
  12. * src/PeerChokeCommand.h: Replaced Time.h with TimeA2.h.
  13. * src/TrackerWatcherCommand.h: Replaced Time.h with TimeA2.h.
  14. * src/PeerAbstractCommand.h: Replaced Time.h with TimeA2.h.
  15. * src/AbstractCommand.h: Replaced Time.h with TimeA2.h.
  16. * src/PeerInteractionCommand.h: Replaced Time.h with TimeA2.h.
  17. * src/ConsoleDownloadEngine.h: Replaced Time.h with TimeA2.h.
  18. * src/TorrentAutoSaveCommand.h: Replaced Time.h with TimeA2.h.
  19. * src/DownloadCommand.h: Replaced Time.h with TimeA2.h.
  20. * src/TorrentMan.h: Replaced Time.h with TimeA2.h.
  21. * src/TorrentDownloadEngine.h: Replaced Time.h with TimeA2.h.
  22. * src/RequestSlot.h: Replaced Time.h with TimeA2.h.
  23. * src/SleepCommand.h: Replaced Time.h with TimeA2.h.
  24. * src/DownloadEngine.cc: Replaced Time.h with TimeA2.h.
  25. 2006-08-07 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  26. * src/PeerChokeCommand.h
  27. (PeerChokeCommand): Rearranged the arguments.
  28. * src/PeerChokeCommand.cc
  29. (PeerChokeCommand): Rearranged the arguments.
  30. * src/MetalinkEntry.h
  31. (Checksum.h): Included.
  32. (md5): Removed.
  33. (sha1): Removed.
  34. (checksum): New variable.
  35. (operator=): Updated.
  36. (check): Removed.
  37. * src/prefs.h
  38. (PREF_LOWEST_SPEED_LIMIT): New definition.
  39. (PREF_FOLLOW_TORRENT): New definition.
  40. (PREF_SELECT_FILE): New definition.
  41. (PREF_FOLLOW_METALINK): New definition.
  42. * src/MetalinkResource.h
  43. (TYPE_HTTPS): Added to enum TYPE.
  44. * src/TorrentMan.cc
  45. (~TorrentMan): Rewritten.
  46. * src/MultiDiskWriter.cc
  47. (MultiDiskAdaptor): Updated according to the changes in
  48. MessageDigestContext.
  49. (~MultiDiskAdaptor): Updated according to the changes in
  50. MessageDigestContext.
  51. (hashUpdate): Updated according to the changes in MessageDigestContext.
  52. (sha1Sum): Updated according to the changes in MessageDigestContext.
  53. * src/Util.h
  54. (fileChecksum): Updated according to the changes in
  55. MessageDigestContext.
  56. * src/Util.cc
  57. (sha1Sum): Updated according to the changes in MessageDigestContext.
  58. (fileChecksum): Updated according to the changes in
  59. MessageDigestContext.
  60. * src/messageDigest.h: Rewritten.
  61. * src/MetalinkEntry.cc
  62. (check): Removed.
  63. (Supported): Updated.
  64. (dropUnsupportedResource): Fixed a memory leak.
  65. * src/ShaVisitor.cc
  66. (ShaVisitor): Updated according to the changes in MessageDigestContext.
  67. (~ShaVisitor): Updated according to the changes in
  68. MessageDigestContext.
  69. (visit): Updated according to the changes in MessageDigestContext.
  70. * src/main.cc
  71. (main): Rewritten the portion of download loop. --lowest-speed-limit
  72. command-line option added.
  73. * src/DownloadEngine.h
  74. (SocketEntry): New class.
  75. (SocketEntries): New definition.
  76. (PairFind): Removed.
  77. (SockCmdMap): Removed.
  78. * src/DownloadEngine.cc
  79. (DownloadEngine): Rewritten.
  80. (~DownloadEngine): Rewritten.
  81. (run): Renamed activeCommandUuids as activeUuids.
  82. (SetDescriptor): Rewritten.
  83. (AccumulateActiveCommandUuid): Removed.
  84. (AccumulateActiveUuid): New function object.
  85. (waitData): Rewritten.
  86. (updateFdSet): Rewritten.
  87. (addSocket): Rewritten.
  88. (deleteSocket): Rewritten.
  89. (addSocketForReadCheck): Rewritten.
  90. (deleteSocketForReadCheck): Rewritten.
  91. (addSocketForWriteCheck): Rewritten.
  92. (deleteSocketForWriteCheck): Rewritten.
  93. * src/Xml2MetalinkProcessor.cc
  94. (getEntry): Rewritten the portion of MetalinkEntry creation.
  95. * src/DownloadCommand.cc
  96. (executeInternal): Added the check routine for lowest speed limit.
  97. * src/AbstractDiskWriter.cc
  98. (AbstractDiskWriter): Updated according to the changes in
  99. MessageDigestContext.
  100. (~AbstractDiskWriter): Updated according to the changes in
  101. MessageDigestContext.
  102. (sha1Sum): Updated according to the changes in MessageDigestContext.
  103. * src/RequestInfo.h: New class.
  104. * src/UrlRequestInfo.h: New class.
  105. * src/UrlRequestInfo.cc: New class.
  106. * src/TorrentRequestInfo.h: New class.
  107. * src/TorrentRequestInfo.cc: New class.
  108. * src/MetalinkRequestInfo.h: New class.
  109. * src/MetalinkRequestInfo.cc: New class.
  110. * src/Checksum.h: New class.
  111. * src/DownloadEngineFactory.h: New class.
  112. * src/DownloadEngineFactory.cc: New class.
  113. 2006-08-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  114. * src/Option.h
  115. (getAsBool): New function.
  116. * src/Option.cc
  117. (prefs.h): Included.
  118. (defined): 0-length value is now recognized as undefined.
  119. (getAsInt): Rewritten.
  120. (getAsLLInt): Rewritten.
  121. (getAsBool): New function.
  122. * src/FeatureConfig.h: Rewritten.
  123. * src/FeatureConfig.cc: Rewritten.
  124. * src/prefs.h
  125. (PREF_STDOUT_LOG): New definition.
  126. (PREF_LOG): New definition.
  127. (PREF_DIR): New definition.
  128. (PREF_OUT): New definition.
  129. (PREF_SPLIT): New definition.
  130. (PREF_DAEMON): New definition.
  131. (PREF_REFERER): New definition.
  132. (PREF_TORRENT_FILE): New definition.
  133. (PREF_LISTEN_PORT): New definition.
  134. (PREF_METALINK_FILE): New definition.
  135. (PREF_METALINK_VERSION): New definition.
  136. (PREF_METALINK_LANGUAGE): New definition.
  137. (PREF_METALINK_OS): New definition.
  138. (PREF_METALINK_SERVERS): New definition.
  139. * src/main.cc
  140. (main): Following command-line parameters are now put into Option
  141. class: stdoutLog, logfile, dir, ufilename, split, daemonMode,
  142. referer, torrentFile, metalinkFile, listenPort, metalinkVersion,
  143. metalinkLanguage, metalinkOs, metalinkServers
  144. To fix the bug that aria2 can not handle http response header properly.
  145. * src/HttpHeader.cc
  146. (put): Made name lowercased.
  147. (defined): Made name lowercased.
  148. (getFirst): Made name lowercased.
  149. (get): Made name lowercased.
  150. (getFirstAsInt): Rewritten.
  151. (getFirstAsLLInt): Rewritten.
  152. 2006-07-30 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  153. * src/TorrentMan.h:
  154. (advertisePiece): Updated doc.
  155. (getAdvertisedPieceIndexes): Updated doc.
  156. (removeAdvertisedPiece); New function.
  157. * src/TorrentMan.cc
  158. (FindElapsedHave): New function object.
  159. (removeAdvertisedPiece): New function.
  160. * src/HaveEraseCommand.h: New class.
  161. * src/HaveEraseCommand.cc: New class.
  162. * src/FeatureConfig.h: New class.
  163. * src/FeatureConfig.cc: New class.
  164. * src/Request.h
  165. (defaultPorts): Removed.
  166. * src/Request.cc
  167. (FeatureConfig.h): Included.
  168. (Request): Removed the statements related to defaultPorts.
  169. (parseUrl): Removed metalinkEnabled. Use FeatureConfig instead.
  170. A default port number is now retrieved from FeatureConfig.
  171. * src/main.cc
  172. (HaveEraseCommand.h): Included.
  173. (showVersion): Added the output of feature list.
  174. (main): Added HaveEraseCommand to command queue in BitTorrent
  175. downloading.
  176. * src/PeerInteractionCommand.h
  177. (chokeCheckPoint): Commented out.
  178. (periodicExecPoint): New variable.
  179. * src/PeerInteractionCommand.cc
  180. (executeInternal): Following methods are now called in at least every
  181. 0.5 seconds to reduce CPU usage:
  182. detectMessageFlooding(), peerInteraction->checkRequestSlot(),
  183. checkHave(), sendKeepAlive().
  184. (checkLongTimePeerChoking): Commented out.
  185. * src/BitfieldMan.h
  186. (getNthBitIndex): Changed the method signature.
  187. (getMissingIndexRandomly): Changed the method signature.
  188. * src/BitfieldMan.cc
  189. (getNthBitIndex): Rewritten
  190. (getMissingIndexRandomly): Rewritten.
  191. (hasMissingPiece): Rewritten.
  192. (getMissingIndex): Refactored.
  193. (getMissingUnusedIndex); Refactored.
  194. (getMissingIndex): Refactored.
  195. 2006-07-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  196. * src/PeerMessage.h
  197. (Piece.h): Included.
  198. (SharedHandle.h): Included.
  199. (invalidate): New variable.
  200. (uploading): New variable.
  201. (isInvalidate): New function.
  202. (isUploading): New function.
  203. (onPush): New function.
  204. (onChoked): New function.
  205. (onCanceled): New function.
  206. (onAbortPiece): New function.
  207. (PeerMessageHandle): New type definition.
  208. * src/PeerMessage.cc
  209. (PeerMessage): Added the initialization for invalidate and uploading.
  210. * src/CancelMessage.h
  211. (CancelMessage): Rewritten.
  212. * src/RejectMessage.h
  213. (RejectMessage): Rewritten.
  214. * src/Metalinker.h
  215. (operator=): Defined.
  216. * src/MetaEntry.h
  217. (operator=): Defined.
  218. * src/MetalinkResource.h
  219. (operator=): Defined.
  220. * src/AllowedFastMessage.h
  221. (AllowedFastMessage): Rewritten.
  222. * src/HandshakeMessage.h
  223. (HandshakeMessage): New function(overload).
  224. * src/HandshakeMessage.cc
  225. (HandshakeMessage): Rewritten.
  226. (init): New function.
  227. * src/HaveMessage.h
  228. (HaveMessage): Rewritten.
  229. * src/Time.h
  230. (operator=): Defined the function body here.
  231. * src/Time.cc
  232. (operator=): Removed.
  233. * src/SocketCore.h
  234. (operator==): Defined here.
  235. (operator!=): Defined here.
  236. (operator<): Defined here.
  237. * src/SocketCore.cc
  238. (operator==): Removed.
  239. (operator<): Removed.
  240. * src/BitfieldMan.h
  241. (operator=): Defined the function body here.
  242. * src/BitfieldMan.cc
  243. (operator=): Removed.
  244. * src/TorrentMan.h
  245. (deleteErrorPeer): Removed.
  246. (deleteUnusedPeer); New function.
  247. * src/TorrentMan.cc
  248. (addPeer): Call deleteUnusedPeer.
  249. (deleteErrorPeer): Removed.
  250. (deleteUnusedPeer): New function.
  251. * src/PeerAbstractCommand.h
  252. (setNoCheck): New function.
  253. (noCheck): New variable.
  254. * src/PeerAbstractCommand.cc
  255. (PeerAbstractCommand): Added the initialization of noCheck.
  256. (execute): Added a check for noCheck.
  257. (setNoCheck): New function.
  258. * src/Util.h
  259. (stdio.h): Included.
  260. * src/Util.cc
  261. (unistd.h): Included.
  262. * src/DefaultDiskWriter.cc
  263. (unistd.h): Included.
  264. * src/Peer.h
  265. (operator==): Defined the function body here.
  266. (operator!=): Defined the function body here.
  267. * src/Peer.cc
  268. (operator==): Removed.
  269. (operator!=): Removed.
  270. * src/Piece.h
  271. (Piece): Defined the function body here(copy constructor).
  272. (operator=): Defined the function body here.
  273. (operator==): Defined the function body here.
  274. * src/Piece.cc
  275. (Piece): Removed(copy constructor).
  276. (operator=): Removed.
  277. (operator==): Removed.
  278. * src/PeerMessageUtil.h
  279. (ChokeMessage.h): Removed.
  280. (UnchokeMessage.h): Removed.
  281. (InterestedMessage.h): Removed.
  282. (NotInterestedMessage.h): Removed.
  283. (HaveMessage.h): Removed.
  284. (BitfieldMessage.h): Removed.
  285. (RequestMessage.h): Removed.
  286. (CancelMessage.h): Removed.
  287. (PieceMessage.h): Removed.
  288. (HandshakeMessage.h): Removed.
  289. (KeepAliveMessage.h): Removed.
  290. (PortMessage.h): Removed.
  291. (HaveAllMessage.h): Removed.
  292. (HaveNoneMessage.h): Removed.
  293. (PeerConnection.h): Removed.
  294. (HandshakeMessage.h): Included.
  295. * src/BitfieldMessage.h
  296. (init): New function.
  297. (BitfieldMessage): Rewritten.
  298. (BitfieldMessage): New function(overload).
  299. * src/RequestSlot.h
  300. (operator=): Defined the function body here.
  301. (operator==): Defined the function body here.
  302. * src/RequestSlot.cc
  303. (operator=): Removed.
  304. (operator==): Removed.
  305. To remove the dependency on the PeerMessage subclass from
  306. PeerInteraction:
  307. * src/PeerMessageFactory.h: New class.
  308. * src/PeerMessageFactory.cc: New class.
  309. * src/SimplePeerMessage.cc
  310. (send): If invalidate is true then do nothing.
  311. * src/PeerInteractionCommand.cc
  312. (HandshakeMessage.h): Included.
  313. (KeepAliveMessage.h): Included.
  314. (ChokeMessage.h): Included.
  315. (UnchokeMessage.h): Included.
  316. (HaveMessage.h): Included.
  317. (executeInternal): Call setNoCheck().
  318. Removed setWriteCheckSocket(socket).
  319. * src/PeerInteraction.h
  320. (ChokeMessage.h): Removed.
  321. (UnchokeMessage.h): Removed.
  322. (InterestedMessage.h): Removed.
  323. (NotInterestedMessage.h): Removed.
  324. (HaveMessage.h): Removed.
  325. (BitfieldMessage.h): Removed.
  326. (RequestMessage.h): Removed.
  327. (CancelMessage.h): Removed.
  328. (PieceMessage.h): Removed.
  329. (HandshakeMessage.h): Removed.
  330. (KeepAliveMessage.h): Removed.
  331. (PortMessage.h): Removed.
  332. (HaveAllMessage.h): Removed.
  333. (HaveNoneMessage.h): Removed.
  334. (RejectMessage.h): Removed.
  335. (AllowedFastMessage.h): Removed.
  336. (SuggestPieceMessage.h): Removed.
  337. (PeerMessageFactory.h): Included.
  338. (PeerMessageHandle): Removed typedef of PeerMessageHandle.
  339. (HandshakeMessageHandle): Removed typedef of HandshakeMessageHandle.
  340. (PeerMessageFactory): New variable.
  341. (createPeerMessage): Removed.
  342. (createHandshakeMessage): Removed.
  343. (setPeerMessageCommonProperty): Removed.
  344. (addRequestSlot): New function.
  345. (receiveHandshake): Changed the return value type to PeerMessageHandle.
  346. (getPeerMessageFactory): New function.
  347. (createRequestMessage): Removed.
  348. (createCancelMessage): Removed.
  349. (createPieceMessage): Removed.
  350. (createHaveMessage): Removed.
  351. (createChokeMessage): Removed.
  352. (createUnchokeMessage): Removed.
  353. (createInterestedMessage): Removed.
  354. (createNotInterestedMessage): Removed.
  355. (createBitfieldMessage): Removed.
  356. (createKeepAliveMessage): Removed.
  357. (createHaveAllMessage): Removed.
  358. (createHaveNoneMessage): Removed.
  359. (createRejectMessage): Removed.
  360. (createAllowedFastMessage): Removed.
  361. * src/PeerInteraction.cc
  362. (PeerInteraction): Allocate PeerMessageFactory here.
  363. (~PeerInteraction): Deallocate PeerMessageFactory here.
  364. (sendMessages): Use msg->isUploading() instead of msg->getId() ==
  365. PieceMessage::ID.
  366. (addMessage): Simplified by using PeerMessage::onPush().
  367. (addRequestSlot): New function.
  368. (rejectAllPieceMessageInQueue): Simplified by using
  369. PeerMessage::onChoked().
  370. (rejectPieceMessageInQueue): Simplified by using
  371. PeerMessage::onCanceled().
  372. (abortPiece): Simplified by using PeerMessage::abortPiece().
  373. (receiveHandshake): Changed the return value type to PeerMessageHandle.
  374. (createHandshakeMessage): Removed.
  375. (createPeerMessage): Removed.
  376. (sendHandshake): Call PeerMessageFactory::createHandshakeMessage().
  377. (setPeerMessageCommonProperty): Removed.
  378. (createRequestMessage): Removed.
  379. (createCancelMessage): Removed.
  380. (createPieceMessage): Removed.
  381. (createHaveMessage): Removed.
  382. (createChokeMessage): Removed.
  383. (createUnchokeMessage): Removed.
  384. (createInterestedMessage): Removed.
  385. (createNotInterestedMessage): Removed.
  386. (createBitfieldMessage): Removed.
  387. (createKeepAliveMessage): Removed.
  388. (createHaveAllMessage): Removed.
  389. (createHaveNoneMessage): Removed.
  390. (createRejectMessage): Removed.
  391. (createAllowedFastMessage): Removed.
  392. * src/PieceMessage.h
  393. (createRejectMessage): New function.
  394. (PieceMessage): Rewritten.
  395. (onChoked): New function.
  396. (onCanceled): New function.
  397. * src/PieceMessage.cc
  398. (send): If invalidate is true then do nothing, just return.
  399. (createRejectMessage): New function.
  400. (onChoked): New function.
  401. (onCanceled): New function.
  402. * src/RequestMessage.h
  403. (RequestMessage): Rewritten.
  404. (onPush): New function.
  405. (onAbortPiece): New function.
  406. * src/RequestMessage.cc
  407. (onPush): New function.
  408. (onAbortPiece): New function.
  409. Update fd_set when a socket is added or deleted in order to improve
  410. performance:
  411. * src/DownloadEngine.h
  412. (rfdset): New variable.
  413. (wfdset): New variable.
  414. (updateFdSet): New function.
  415. * src/DownloadEngine.cc
  416. (SetDescriptor::operator()): Use SockCmdMap::value_type.
  417. (AccumulateActiveCommandUuid::operator()): Use SockCmdMap::value_type.
  418. (waitData): Copy rfdset and wfdset.
  419. (updateFdSet): New function.
  420. (addSocket): Call updateFdSet.
  421. (deleteSocket): Call updateFdSet.
  422. 2006-07-21 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  423. To add the support for Metalink3.0 backward compatible links:
  424. * src/Request.h
  425. (SAFE_CHARS): Added '#'.
  426. (METALINK_MARK): New definition.
  427. * src/Request.cc
  428. (parseUrl): Added the support for Metalink3.0 backward compatible
  429. links.
  430. etc
  431. * src/PeerInteraction.cc
  432. (MsgPushBack): Removed.
  433. (sendMessages): Use STL copy and back_inserter.
  434. (rejectAllPieceMessageInQueue): Use STL copy and back_inserter.
  435. (rejectPieceMessageInQueue): Use STL copy and back_inserter.
  436. * src/TorrentMan.h
  437. (MAX_PEER_LIST_SIZE): Changed to 100 from 250.
  438. 2006-07-19 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  439. * src/SharedHandle.h: New class.
  440. To wrap Socket, Command, PeerMessage and Peer with SharedHandle:
  441. * src/HttpResponseCommand.h
  442. (HttpResponseCommand): Wrapped Socket.
  443. * src/SocketCore.h
  444. (operator==): New function.
  445. (operator!=): New function.
  446. (operator<): New function.
  447. (getSockfd): New function.
  448. (isOpen): New function.
  449. (writeData): New function.
  450. * src/SocketCore.cc
  451. (operator==): New function.
  452. (operator!=): New function.
  453. (operator<): New function.
  454. * src/AbstractCommand.h
  455. (socket): Changed its type to SocketHandle.
  456. (setReadCheckSocket): Replaced Socket with SocketHandle.
  457. (setWriteCheckSocket): Replaced Socket with SocketHandle.
  458. (disableReadCheckSocket): New function.
  459. (disableWriteCheckSocket): New function.
  460. (readCheckTarget): Changed its type to SocketHandle.
  461. (writeCheckTarget): Changed its type to SocketHandle.
  462. (AbstractCommand): Replaced Socket with SocketHandle.
  463. * src/AbstractCommand.cc
  464. (AbstractCommand): Replaced Socket with SocketHandle.
  465. (~AbstractCommand): Removed the deallocation for Socket object.
  466. (disableReadCheckSocket): New function.
  467. (setReadCheckSocket): Replaced Socket with SocketHandle.
  468. (disableWriteCheckSocket): New function.
  469. (setWriteCheckSocket): Replaced Socket with SocketHandle.
  470. * src/HttpDownloadCommand.cc
  471. (DownloadCommand): Replaced Socket with SocketHandle.
  472. * src/PeerAbstractCommand.h
  473. (socket): Changed its type to SocketHandle.
  474. (peer): Changed its type to PeerHandle.
  475. (setReadCheckSocket): Replaced Socket with SocketHandle.
  476. (setWriteCheckSocket): Replaced Socket with SocketHandle.
  477. (disableReadCheckSocket): New function.
  478. (disableWriteCheckSocket): New function.
  479. (readCheckTarget): Changed its type to SocketHandle.
  480. (writeCheckTarget): Changed its type to SocketHandle.
  481. (PeerAbstractCommand): Replaced Socket with SocketHandle.
  482. Replaced Peer with PeerHandle.
  483. * src/HttpRequestCommand.cc
  484. (HttpRequestCommand): Replaced Socket with SocketHandle.
  485. Use disableReadCheckSocket.
  486. * src/PeerInitiateConnectionCommand.h
  487. (PeerInitiateConnectionCommand): Replaced Peer with PeerHandle.
  488. * src/PeerChokeCommand.cc
  489. (UploadFaster::operator()): Replaced Peer with PeerHandle.
  490. (DownloadFaster::operator()): Replaced Peer with PeerHandle.
  491. (execute): Use PeerHandle.
  492. * src/PeerConnection.h
  493. (HandshakeMessage.h): Removed include of HandshakeMessage.h.
  494. (socket): Changed its type to SocketHandle.
  495. (PeerConnection): Replaced Socket with SocketHandle.
  496. * src/PeerConnection.cc
  497. (PeerConnection): Replaced Socket with SocketHandle.
  498. * src/PeerInteractionCommand.h
  499. (PeerInteractionCommand): Replaced socket with SocketHandle.
  500. Replaced Peer with PeerHandle.
  501. * src/PeerInteractionCommand.cc
  502. (PeerInteractionCommand): Replaced Socket with SocketHandle.
  503. Replaced Peer with PeerHandle.
  504. (executeInternal): Use disableWriteCheckSocket.
  505. Use HandshakeMessageHandle.
  506. (receiveMessages): Use PeerMessageHandle.
  507. (prepareForNextPeer): Use PeerHandle.
  508. * src/HttpProxyRequestCommand.h
  509. (HttpProxyRequestCommand): Replaced Socket with SocketHandle.
  510. * src/HttpResponseCommand.cc
  511. (HttpResponseCommand): Replaced Socket with SocketHandle.
  512. * src/TorrentMan.cc
  513. (nullPeer): Added external reference.
  514. (~TorrentMan): Removed the deallocation of the elements of peers.
  515. (addPeer): Rewritten.
  516. (isPeerAvailable): Use nullPeer.
  517. (deleteOldpeers): Replaced with deleteErrorPeer.
  518. (deleteErrorPeer): New function.
  519. (getPeer): Use PeerHandle and nullPeer.
  520. (hasMissingPiece): Replaced Peer with PeerHandle.
  521. (getMissingPieceIndex): Replaced Peer with PeerHandle.
  522. (getMissingFastPieceIndex): Replaced Peer with PeerHandle.
  523. (getMissingFastPiece): Replaced Peer with PeerHandle.
  524. (getMissingPiece): Replaced Peer with PeerHandle.
  525. * src/FtpNegotiateCommand.cc
  526. (FtpNegotiationCommand): Replaced Peer with PeerHandle.
  527. (~FtpNegotiationCommand): Removed the deallocation of Sockets.
  528. (recvGreeting): Use disableWriteCheckSocket.
  529. (recvPasv): Removed the allocation of Socket.
  530. Use disableReadCheckSocket.
  531. (sendRestPasv): Use disableWriteCheckSocket.
  532. (recvRetr): Changed assertion.
  533. * src/PeerInteraction.h
  534. (SharedHandle.h): Included SharedHandle.h.
  535. (PeerMessageHandle): New type definition.
  536. (HandshakeMessageHandle): New type definition.
  537. (MessageQueue): Changed. Now its element is of type PeerMessageHandle.
  538. (peer): Changed its type to PeerHandle.
  539. (createHandshakeMessage): Replaced HandshakeMessage with
  540. HandshakeMessageHandle.
  541. (createPeerMessage): Replaced PeerMessageHandle with PeerMessage.
  542. (PeerInteraction): Replaced Peer with PeerHandle.
  543. Replaced Socket with SocketHandle.
  544. (addMessage): Replaced PeerMessage with PeerMessageHandle.
  545. (receiveMessage): Replaced PeerMessage with PeerMessageHandle.
  546. (receiveHandshake): Replaced HandshakeMessage with
  547. HandshakeMessageHandle.
  548. * src/PeerInteraction.cc
  549. (PeerInteraction): Replaced Peer with PeerHandle.
  550. Replaced Socket with SocketHandle.
  551. (~PeerInteraction): Removed the deallocation of the elements of
  552. messageQueue.
  553. (MsgPushBack::operator()): Replaced PeerMessage with PeerMessageHandle.
  554. (isSendingMessageInProgress): Replaced PeerMessage with
  555. PeerMessageHandle.
  556. (sendMessages): Use PeerMessageHandle. Removed try-catch block.
  557. (addMessage): Replaced PeerMessage with PeerMessageHandle.
  558. (rejectAllPieceMessageInQueue): Use PeerMessageHandle.
  559. (rejectPieceMessageInQueue): Use PeerMessageHandle.
  560. (abortPiece): Use PeerMessageHandle.
  561. (receiveHandshake): Replaced HandshakeMessage with
  562. HandshakeMessageHandle. Removed try-catch block.
  563. (createHandshakeMessage): Replaced HandshakeMessage with
  564. HandshakeMessageHandle.
  565. (receiveMessage): Replaced PeerMessage with PeerMessageHandle.
  566. Removed try-catch block.
  567. (createPeerMessage): Replaced PeerMessage with PeerMessageHandle.
  568. * src/HttpProxyResponseCommand.cc
  569. (HttpProxyRequestCommand): Replaced Socket with SocketHandle.
  570. * src/FtpTunnelResponseCommand.h
  571. (FtpTunnelResponseCommand): Replaced Socket with SocketHandle.
  572. * src/HttpConnection.cc
  573. (HttpConnection): Replaced Socket with SocketHandle.
  574. * src/PeerAbstractCommand.cc
  575. (PeerAbstractCommand): Replaced Socket with SocketHandle.
  576. (~PeerAbstractCommand): Removed the deallocation of socket.
  577. Use disableReadCheckSocket, disableWriteCheckSocket.
  578. (disableReadCheckSocket): New function.
  579. (setReadCheckSocket): Replaced Socket with SocketHandle.
  580. (disableWriteCheckSocket): New function.
  581. (setWriteCheckSocket): Replaced Socket with SocketHandle.
  582. * src/InitiateConnectionCommandFactory.h: Corrected indentation.
  583. * src/FtpTunnelRequestCommand.cc
  584. (FtpTunnelRequestCommand): Replaced Socket with SocketHandle.
  585. (~FtpTunnelRequestCommand): Corrected indentation.
  586. * src/DownloadCommand.h
  587. (DownloadCommand): Replaced Socket with SocketHandle.
  588. * src/PeerListenCommand.cc
  589. (PeerListenCommand): Removed the initialization of socket.
  590. (~PeerListenCommand): Removed the deallocation of socket.
  591. (bindPort): Use SocketHandle.
  592. (execute): Use SocketHandle and PeerHandle.
  593. * src/FtpDowndloadCommand.cc
  594. (FtpDownloadCommand): Replaced Socket with SocketHandle.
  595. (~FtpDownloadCommand): Removed the deallocation of ctrlSocket.
  596. * src/main.cc
  597. (main): Corrected indentation.
  598. * src/HttpInitiateConnectionCommand.cc
  599. (HttpInitiateConnectionCommand): Replaced Socket with SocketHandle.
  600. (executeInternal): Removed the allocation of socket.
  601. * src/HttpRequestCommand.h
  602. (HttpRequestCommand): Replaced Socket with SocketHandle.
  603. * src/FtpNegotiationCommand.h
  604. (dataSocket): Changed its type to SocketHandle.
  605. (serverSocket): Changed its type to SocketHandle.
  606. (FtpNegotiationCommand): Replaced Socket with SocketHandle.
  607. * src/TorrentMan.h
  608. (MAX_PEER_UPDATE): Removed.
  609. (MAX_PEERS): New definition.
  610. (Peers): The element is now of type PeerHandle.
  611. (addPeer): Replaced Peer with PeerHandle. Removed 'duplicate' argument.
  612. (getPeer): Replaced Peer with PeerHandle.
  613. (deleteOldErrorPeers): Removed.
  614. (deleteErrorPeer): New function.
  615. (hasMissingPiece): Replaced Peer with PeerHandle.
  616. (getMissingPieceIndex): Replaced Peer with PeerHandle.
  617. (getMissingPiece): Replaced Peer with PeerHandle.
  618. (getMissingFastPieceIndex): Replaced Peer with PeerHandle.
  619. (getMissingFastPiece): Replaced Peer with PeerHandle.
  620. (addActivePeer): Replaced Peer with PeerHandle.
  621. (deleteActivePeer): Replaced Peer with PeerHandle.
  622. Added a check for the return value of find.
  623. * src/FtpTunnelResponseCommand.cc
  624. (FtpTunnelResponseCommand): Replaced Socket with SocketHandle.
  625. * src/FtpInitiateConnectionCommand.cc
  626. (executeInternal): Removed the allocation of socket.
  627. * src/DownloadEngine.h
  628. (Sockets): An element is now of type SocketHandle.
  629. (SockCmdMap): A key is of type SocketHandle, a value is of type int.
  630. (CommandUuids): New type definition.
  631. (rsockets): Changed its type to SockCmdMap.
  632. (wsockets): Changed its type to SockCmdMap.
  633. (addSocket): Rewritten.
  634. (deleteSocket): Rewritten.
  635. (addSocketForReadCheck): Rewritten.
  636. (deleteSocketForReadCheck): Rewritten.
  637. (addSocketForWriteCheck): Rewritten.
  638. (deleteSocketForWriteCheck): Rewritten.
  639. (PairFind): New template class.
  640. * src/HttpDownloadCommand.h
  641. (HttpDownloadCommand): Replaced Socket with SocketHandle.
  642. * src/FtpConnection.cc
  643. (FtpConnection): Replaced Socket with SocketHandle.
  644. (sendPort): Removed the allocation of serverSocket. Removed try-catch
  645. block.
  646. * src/InitiateConnectionCommandFactory.cc
  647. (DlAbortEx.h): Included DlAbortEx.h.
  648. (createInitiateConnectionCommand): Throw exception if the protocol of
  649. requested URI is not supported.
  650. * src/Peer.cc
  651. (nullPeer): Changed its type to PeerHandle.
  652. (operator==): New function.
  653. (operator!=): New function.
  654. * src/Peer.h
  655. (SharedHandle.h): Included SharedHandle.h.
  656. (operator==): New function.
  657. (operator!=): New function.
  658. (Peer): Added the default constructor.
  659. Use resetStatus() to initialize member variables.
  660. (nullPeer): Removed.
  661. * src/TrackerUpdateCommand.cc
  662. (execute): Brushed up using SharedHandle. Replaced MAX_PEER_UPDATE
  663. with MIN_PEERS.
  664. * src/PeerListenCommand.h
  665. (socket): Changed its type to SocketHandle.
  666. * src/Command.h
  667. (CommandUuid): New type definition.
  668. (uuid): New variable.
  669. (uuidGen): New variable.
  670. (Command): Added the initialization of uuid.
  671. (getUuid): New function.
  672. * src/Socket.h
  673. (Socket): Removed.
  674. (SocketHandle): New type definition.
  675. * src/DownloadEngine.h
  676. (FindCommand): New function object.
  677. (run): The portion of socket check was rewritten.
  678. (SetDescriptor): New function object.
  679. (AccumulateActiveCommandUuid): New function object.
  680. (waitData): Rewritten.
  681. (addSocket): Rewritten.
  682. (deleteSocket): Rewritten.
  683. (addSocketForReadCheck): Rewritten.
  684. (addSocketForWriteCheck): Rewritten.
  685. (deleteSocketForReadCheck): Rewritten.
  686. (deleteSocketForWriteCheck): Rewritten.
  687. * src/HttpProxyResponseCommand.h
  688. (HttpProxyResponseCommand): Replaced Socket with SocketHandle.
  689. * src/HttpConnection.h
  690. (socket): Changed its type to SocketHandle.
  691. (HttpConnection): Replaced Socket with SocketHandle.
  692. * src/PeerInitiateConnectionCommand.cc
  693. (PeerInitiateConnectionCommand): Replaced Peer with PeerHandle.
  694. (executeInternal): Removed the allocation of socket.
  695. (prepareForNextPeer): Use PeerHandle.
  696. * src/PeerMessage.h
  697. (peer): Changed its type to PeerHandle.
  698. (getPeer): Replaced Peer with PeerHandle.
  699. (setPeer): Replaced Peer with PeerHandle.
  700. * src/DownloadCommand.cc
  701. (DownloadCommand): Replaced Socket with SocketHandle.
  702. * src/FtpConnection.h
  703. (socket): Changed its type to SocketHandle.
  704. (FtpConnection): Replaced Socket with SocketHandle.
  705. (sendPort); Replaced Socket with SocketHandle.
  706. * src/FtpDowndloadCommand.h
  707. (ctrlSocket): Changed its type to SocketHandle.
  708. (FtpDownloadCommand): Replaced Socket with SocketHandle.
  709. * src/HttpProxyRequestCommand.cc
  710. (HttpProxyRequestCommand): Replaced Socket with SocketHandle.
  711. * src/FtpTunnelRequestCommand.h
  712. (FtpTunnelRequestCommand): Replaced Socket with SocketHandle.
  713. etc
  714. * src/PeerChokeCommand.h
  715. (setAllPeerChoked): Removed.
  716. (setAllPeerResetDelta): Removed.
  717. * src/PeerChokeCommand.cc
  718. (setAllPeerChoked): Removed.
  719. (ChokePeer): New function object.
  720. (setAllPeerResetDelta): Removed.
  721. (ResetDelta): New function object.
  722. (orderByDownloadRate): Fixed a bug: use DowloadFaster, not UploadFaster
  723. (execute): Show download speed when the local node is a seeder.
  724. setAllPeerChoked and setAllPeerResetDelta were rewritten
  725. using STL.
  726. * src/TrackerWatcherCommand.h
  727. (MIN_PEERS): Removed.
  728. * src/TorrentMan.cc
  729. (getPeer): Replaced MAX_PEER_UPDATE with MIN_PEERS.
  730. 2006-07-07 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  731. To fix the bug that .aria2 file is not saved if downloading is stopped
  732. by the errors:it results that aria2 can not resume downloading:
  733. * src/main.cc
  734. (normalDownload): Added the call to save().
  735. (main): Added the deletion of the elements in 'reserved'.
  736. To fix log:
  737. * src/PeerInteraction.cc
  738. (receiveHandshake): Fixed log.
  739. 2006-07-05 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  740. To improve download performance in BitTorrent:
  741. * src/TorrentMan.cc
  742. (getPeer): Check the number of connections. Return nullPeer if
  743. it is greater than MAX_PEER_UPDATE.
  744. This code was originally here, but was removed in 0.5.1.
  745. 2006-07-04 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  746. To improve the conditional compilation:
  747. * src/MultiDiskWriter.h:
  748. Replaced ENABLE_SHA1DIGEST with ENABLE_MESSAGE_DIGEST.
  749. * src/MultiDiskWriter.cc:
  750. Replaced ENABLE_SHA1DIGEST with ENABLE_MESSAGE_DIGEST.
  751. * src/Util.h:
  752. Replaced ENABLE_SHA1DIGEST with ENABLE_MESSAGE_DIGEST.
  753. Added ENABLE_BITTORRENT around computeFastSet().
  754. * src/Util.cc:
  755. Replaced ENABLE_SHA1DIGEST with ENABLE_MESSAGE_DIGEST.
  756. Added ENABLE_BITTORRENT around computeFastSet().
  757. * src/messageDigest.h:
  758. Replaced ENABLE_BITTORRENT with ENABLE_SSL.
  759. * src/ShaVisitor.h:
  760. Replaced ENABLE_SHA1DIGEST with ENABLE_MESSAGE_DIGEST.
  761. * src/ShaVisitor.cc:
  762. Replaced ENABLE_SHA1DIGEST with ENABLE_MESSAGE_DIGEST.
  763. * src/main.cc:
  764. Added ENABLE_BITTORRENT around includes and blocks related to
  765. BitTorrent.
  766. Added ENABLE_MESSAGE_DIGEST to skip checksum checking when the message
  767. digest support is not available.
  768. * src/AbstractDiskWriter.h:
  769. Replaced ENABLE_SHA1DIGEST with ENABLE_MESSAGE_DIGEST.
  770. * src/AbstractDiskWriter.cc:
  771. Replaced ENABLE_SHA1DIGEST with ENABLE_MESSAGE_DIGEST.
  772. * src/MetalinkEntry.cc
  773. (check): Added ENABLE_MESSAGE_DIGEST. Return true if the message digest
  774. support is not available.
  775. To add command-line options for Metalink:
  776. * src/main.cc:
  777. Added metalink-version, metalink-language, metalink-os,
  778. follow-metalink.
  779. To use EXIT_SUCCESS and EXIT_FAILURE with exit():
  780. * src/main.cc: Use these definition.
  781. * Release 0.6.0
  782. 2006-07-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  783. To add Metalink support(http/ftp only):
  784. * src/AbstractCommand.h
  785. (tryReserved): New function.
  786. * src/AbstractCommand.cc
  787. (execute): Call tryReserved().
  788. (tryReserved): New function.
  789. * src/Request.h
  790. (Requests): New type definition.
  791. * src/SegmentMan.h
  792. (reserved): New variable.
  793. * src/Util.h
  794. (fileChecksum): New function.
  795. (toUpper): New function.
  796. (toLower): New function.
  797. * src/Util.cc
  798. (messageDigest.h): Included.
  799. (trim): Trim \r\n\t.
  800. (fileChecksum): New function.
  801. (toUpper): New function.
  802. (toLower): New function.
  803. * src/main.cc
  804. (normalDownload): New function.
  805. (main): Added 2 command-line options: metalink-file,
  806. metalink-connection. Their usage has not been written yet.
  807. * src/MetalinkProcessor.h: New class.
  808. * src/Xml2MetalinkProcessor.h: New class.
  809. * src/Xml2MetalinkProcessor.cc: New class.
  810. * src/MetalinkEntry.h: New class.
  811. * src/MetalinkEntry.cc: New class.
  812. * src/MetalinkResource.h: New class.
  813. * src/MetalinkResource.cc: New class.
  814. To add md5 message digest checking:
  815. * src/messageDigest.h: Rewritten.
  816. * src/MultiDiskWriter.cc: Updated according to the changes in
  817. messageDigest.h.
  818. * src/ShaVisitor.cc: Updated according to the changes in
  819. messageDigest.h.
  820. * src/Util.cc: Updated according to the changes in messageDigest.h.
  821. * src/AbstractDiskWriter.cc: Updated according to the changes in
  822. messageDigest.h.
  823. To fix a bug that causes segfault when the payload length in peer
  824. message is less than 0:
  825. * src/PeerConnection.cc:
  826. (receiveMessage): Fixed the bug.
  827. * src/PeerMessageUtil.cc
  828. (checkLength): Throw an exception if length is less than or equals to
  829. 0.
  830. To add new interfaces to Base64 encoding/decoding:
  831. * src/Base64.h
  832. (part_encode): Changed the method signature.
  833. (encode): New function(overload).
  834. (decode): New function(overload).
  835. * src/Base64.cc
  836. (part_encode): Rewritten.
  837. (encode): Rewritten.
  838. (encode): New function(overload).
  839. To prevent a peer to download same piece if there is an error in
  840. checksum:
  841. * src/PieceMessage.cc
  842. (receivedAction): Call peerInteraction->abortPiece().
  843. 2006-06-25 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  844. To fix the bug that causes same have message is sent many times to
  845. a single peer.
  846. * src/Time.cc
  847. (isNewer): Use Util::difftv().
  848. * src/Util.cc
  849. (difftv): Added a cast to (long long int).
  850. * src/TorrentMan.cc
  851. (advertisePiece): Use push_front.
  852. (getAdvertisedPieceIndexes): A performance improvement was made.
  853. To fix the bug that sends tracker requests without a sleep interval
  854. when the number of connections is less than 15.
  855. * src/TrackerWatcherCommand.cc
  856. (execute): Now the number of connections is not a factor to decide
  857. whether or not a tracker request should be sent or not.
  858. * src/Time.h
  859. (setTimeInSec): New function.
  860. * src/Time.cc
  861. (setTimeInSec): New function.
  862. etc.
  863. * src/ChokeMessage.cc
  864. (receivedAction): Removed peer->snubbing = false
  865. * src/PeerConnection.h
  866. (receiveHandshake): Updated doc.
  867. * src/TorrentMan.h
  868. (getAdvertisedPieceIndexes): Updated the method signature.
  869. * src/TorrentMan.cc
  870. (getAdvertisedPieceIndexes): Updated the method signature.
  871. * src/Time.h
  872. (getTimeInMicros): Added a cast to (long long int).
  873. (getTimeInMillis): Added a cast to (long long int).
  874. * Release 0.5.2
  875. 2006-06-22 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  876. To make a listening socket non-block:
  877. * src/SocketCore.h
  878. (setNonBlockingMode): New function.
  879. * src/SocketCore.cc
  880. (setNonBlockingMode): New function.
  881. (beginListen): Added a call to setNonBlockingMode().
  882. (acceptConnection): Call setNonBlockingMode().
  883. (setBlockingMode): Updated.
  884. To handle tracker's NAT-checking:
  885. * src/PeerConnection.cc
  886. (receiveHandshake): 'msg' param is filled with received data and
  887. its length is assigned to 'length' param, even if all handshake
  888. message is not yet received.
  889. * src/PeerInteractionCommand.cc
  890. (executeInternal): Use peerInteraction->receiveHandshake(true) when
  891. a new peer connects to localhost.
  892. A call to peerInteraction->sendHandshake() was removed because
  893. it is called from peerInteraction->receiveHandshake(true).
  894. * src/PeerInteraction.h
  895. (quickReplied): New variable.
  896. (receiveHandshake): Added an argument.
  897. * src/PeerInteraction.cc
  898. (PeerInteraction): Added the initialization of quickReplied.
  899. (receiveHandshake): Send handshake message as soon as the info hash
  900. in a handshake message from a peer is correct.
  901. To change the random part of peer id and key parameter:
  902. * src/TorrentMan.h
  903. (key): New variable.
  904. * src/TorrentMan.cc
  905. (setupInternal1): Use Util::randomAlpha() to generate random part
  906. of peer id, which is now "-aria2-"+13 alphabet characters([A-Za-z]).
  907. key is also generated by Util::randomAlpha() and it is now 8 character
  908. long.
  909. * src/Util.h
  910. (randomAlpha): New function.
  911. * src/Util.cc
  912. (randomAlpha): New function.
  913. * src/TrackerWatcherCommand.cc
  914. (execute): In a tracker request: Use torrentMan->key as key parameter.
  915. Added no_peer_id=1.
  916. Set snubbing flag to false when a choke message is received from a
  917. snubbed peer.
  918. * src/ChokeMessage.cc
  919. (receivedAction): Set snubbing flag to false.
  920. 2006-06-18 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  921. * src/TorrentMan.cc (setupInternal1): Fixed peerId generation bug.
  922. * src/SimpleLogger.h (writeHeader): New function.
  923. * src/SimpleLogger.cc (writeHeader): New function.
  924. (writeLog): Fixed the bug that causes segfaults if exception message
  925. contains an unescaped "%" character.
  926. * src/TrackerWatcherCommand.cc (execute): Added a short sleep
  927. when a tracker request fails.
  928. * src/Request.cc (parseUrl): Query string is now handled properly.
  929. * Release 0.5.1
  930. 2006-06-12 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  931. To add Time class which represents a specific instant in time and
  932. its precision is microseconds. Time checking procedures were rewritten
  933. using this object.
  934. * src/Time.h: New class.
  935. * src/Time.cc: New class.
  936. * src/AbstractCommand.h
  937. (updateCheckPoint): Removed.
  938. (isTimeoutDetected): Removed.
  939. (checkPoint): Changed the type to Time.
  940. (timeout): New variable.
  941. (setTimeout): New function.
  942. * src/AbstractCommand.cc
  943. (AbstractCommand): Removed the initialization of checkPoint.
  944. Added the initialization of timeout.
  945. (updateCheckPoint): Removed.
  946. (isTimeoutDetected): Removed.
  947. (execute): Use checkPoint.reset() and checkPoint.elapsed().
  948. * src/PeerChokeCommand.h
  949. (checkPoint): Changed the type to Time.
  950. * src/PeerChokeCommand.cc
  951. (PeerChokeCommand): Removed the initialization of checkPoint.
  952. (execute): Rewritten using Time object.
  953. * src/TrackerWatcherCommand.h
  954. (checkPoint): Changed the type to Time.
  955. * src/TrackerWatcherCommand.cc
  956. (TrackerWatcherCommand): Removed the initialization of checkPoint.
  957. (execute): Rewritten.
  958. * src/ConsoleDownloadEngine.h
  959. (cp): Changed the type to Time.
  960. (startup): Changed the type to Time.
  961. * src/ConsoleDownloadEngine.cc
  962. (initStatistics): Use cp.reset(), startup.reset().
  963. (calculateStatistics): Rewritten using Time object.
  964. * src/PeerAbstractCommand.h
  965. (updateCheckPoint): Removed.
  966. (isTimeoutDetected): Removed.
  967. (checkPoint): Changed the type to Time.
  968. * src/PeerAbstractCommand.cc
  969. (PeerAbstractCommand): Removed the initialization of checkPoint.
  970. (updateCheckPoint): Removed.
  971. (isTimeoutDetected): Removed.
  972. (execute): Use checkPoint.reset() and checkPoint.elapsed().
  973. * src/PeerInteractionCommand.cc
  974. (PeerInteractionCommand): Removed the initializations of struct
  975. timeval variables.
  976. * src/PeerInteractionCommand.h
  977. (keepAliveCheckPoint): Changed the type to Time.
  978. (chokeCheckPoint): Changed the type to Time.
  979. (freqCheckPoint): Changed the type to Time.
  980. (haveCheckTime): Changed the type to Time.
  981. * src/PeerInteractionCommand.cc
  982. (executeInternal): Rewritten using Time object.
  983. (detectMessageFlooding): Rewritten using Time object.
  984. (checkLongTimePeerChoking): Rewritten using Time object.
  985. (sendKeepAlive): Rewritten using Time object.
  986. (checkHave): Rewritten using Time object.
  987. * src/SleepCommand.h
  988. (checkPoint): Changed the type to Time.
  989. * src/SleepCommand.cc
  990. (SleepCommand): Removed the initialization of checkPoint.
  991. (execute): Rewritten using Time object.
  992. * src/TorrentAutoSaveCommand.h
  993. (checkPoint): Changed the type to Time.
  994. * src/TorrentAutoSaveCommand.cc
  995. (TorrentAutoSaveCommand): Removed the initialization of checkPoint.
  996. (execute): Rewritten.
  997. * src/DownloadCommand.h
  998. (sw): Changed the type to Time.
  999. * src/DownloadCommand.cc
  1000. (DownloadCommand): Removed the initialization of sw.
  1001. (executeInternal): Rewritten.
  1002. * src/RequestSlot.h
  1003. (dispatchedTime): Changed the type to Time.
  1004. * src/RequestSlot.cc
  1005. (RequestSlot): Removed the call to setDispatchedTime().
  1006. (setDispatchedTime): Rewirtten.
  1007. (isTimeout): Rewritten.
  1008. (getLatencyInMillis): Rewritten.
  1009. * src/TorrentDownloadEngine.h
  1010. (cp): Changed the type to Time[2].
  1011. (startup): Changed the type to Time.
  1012. * src/TorrentDownloadEngine.cc
  1013. (initStatistics): Rewritten.
  1014. (calculateStatistics): Rewritten.
  1015. * src/DownloadEngine.cc
  1016. (run): Rewritten.
  1017. To detect all attempts to connect to the tracker are failed:
  1018. * src/AbstractCommand.cc
  1019. (execute): Increment e->segmentMan->errors if a command aborted.
  1020. * src/SegmentMan.h
  1021. (errors): New variable.
  1022. * src/SegmentMan.cc
  1023. (SegmentMan): Added the initialization of errors.
  1024. (init): Added the initialization of errors.
  1025. * src/TrackerWatcherCommand.cc
  1026. (execute): If e->segmentMan->errors > 0 then assume that the tracker
  1027. request was failed.
  1028. To handle snubbed peers:
  1029. * src/PeerChokeCommand.cc
  1030. (optUnchokingPeer): Snubbed peers don't get unchoked.
  1031. (execute): Snubbed peers don't get unchoked.
  1032. * src/PeerInteraction.h
  1033. (REQUEST_TIME_OUT): Changed the value from 120 to 60.
  1034. * src/PeerInteraction.cc
  1035. (checkRequestSlot): A peer get marked as "snubbed" if it doesn't send
  1036. back the requested 16k block in 60 seconds.
  1037. * src/PieceMessage.cc
  1038. (receivedAction): A peer's snubbed state is cleard if it sends
  1039. the requested 16k block in 60 seconds.
  1040. * src/Peer.h
  1041. (snubbing): New variable.
  1042. * src/Peer.cc
  1043. (resetStatus): Added snubbed = false.
  1044. To fix the bug that causes have message is not sent:
  1045. * src/PeerInteractionCommand.cc
  1046. (~PeerInteractionCommand): Removed e->torrentMan->unadvertisePiece().
  1047. (FLOODING_CHECK_INTERVAL): New definition(temporal).
  1048. (detectMessageFlooding): Use FLOODING_CHECK_INTERVAL.
  1049. * src/TorrentMan.h
  1050. (HaveEntry): New class.
  1051. (advertisePiece): Rewritten.
  1052. (getAdvertisedPieceIndexes): Rewritten.
  1053. (Haves): Changed the type.
  1054. (getAdvertisedPieceIndexes): Added an argument.
  1055. Others:
  1056. * src/TorrentMan.h
  1057. (DEFAULT_ANNOUNCE_INTERVAL): Changed the value to 1800.
  1058. (DEFAULT_ANNOUNCE_MIN_INTERVAL): Changed the value to 1800.
  1059. * src/TorrentMan.cc
  1060. (getPeer): Don't check the number of connections here.
  1061. (setupInternal1): Changed peerId.
  1062. * src/PeerInteractionCommand.h
  1063. (KEEP_ALIVE_INTERVAL): New definition.
  1064. (sendKeepAlive): Use KEEP_ALIVE_INTERVAL.
  1065. * src/main.cc
  1066. (main): SA_ONESHOT was replaced with SA_RESETHAND.
  1067. * src/DownloadEngine.h: Removed unnecessary header includes.
  1068. 2006-05-29 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  1069. To fix the bug that causes segfaults if a tracker returns a zero-length
  1070. list as "peers":
  1071. * src/TrackerUpdateCommand.cc
  1072. (execute): Added a check to see wether the type of peers is Data*.
  1073. 2006-05-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  1074. * Release 0.5.0
  1075. To fix compile issue with gcc3:
  1076. * src/CancelMessage.h
  1077. (ID): Renamed as ID_t
  1078. (ID_t): New enum.
  1079. * src/RejectMessage.h
  1080. (ID): Renamed as ID_t
  1081. (ID_t): New enum.
  1082. * src/SuggestPieceMessage.h
  1083. (ID): Renamed as ID_t
  1084. (ID_t): New enum.
  1085. * src/AllowedFastMessage.h
  1086. (ID): Renamed as ID_t
  1087. (ID_t): New enum.
  1088. * src/PortMessage.h
  1089. (ID): Renamed as ID_t
  1090. (ID_t): New enum.
  1091. * src/HaveNoneMessage.h
  1092. (ID): Renamed as ID_t
  1093. (ID_t): New enum.
  1094. * src/KeepAliveMessage.h
  1095. (ID): Renamed as ID_t
  1096. (ID_t): New enum.
  1097. * src/HaveAllMessage.h
  1098. (ID): Renamed as ID_t
  1099. (ID_t): New enum.
  1100. * src/UnchokeMessage.h
  1101. (ID): Renamed as ID_t
  1102. (ID_t): New enum.
  1103. * src/BitfieldMessage.h
  1104. (ID): Renamed as ID_t
  1105. (ID_t): New enum.
  1106. * src/PieceMessage.h
  1107. (ID): Renamed as ID_t
  1108. (ID_t): New enum.
  1109. * src/RequestMessage.h
  1110. (ID): Renamed as ID_t
  1111. (ID_t): New enum.
  1112. * src/NotInterestedMessage.h
  1113. (ID): Renamed as ID_t
  1114. (ID_t): New enum.
  1115. * src/ChokeMessage.h
  1116. (ID): Renamed as ID_t
  1117. (ID_t): New enum.
  1118. * src/InterestedMessage.h
  1119. (ID): Renamed as ID_t
  1120. (ID_t): New enum.
  1121. * src/HaveMessage.h
  1122. (ID): Renamed as ID_t
  1123. (ID_t): New enum.
  1124. 2006-05-26 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  1125. * src/PeerAbstractCommand.h
  1126. (beforeSocketCheck): Removed.
  1127. * src/PeerAbstractCommand.cc
  1128. Modified in order to call executeInternal() even if socket check
  1129. and upload limit check fail.
  1130. * src/PeerInteractionCommand.h
  1131. (keepAlive): Removed.
  1132. (sendKeepAlive): New function.
  1133. (checkHave): New function.
  1134. (beforeSocketCheck): Removed.
  1135. * src/PeerInteractionCommand.cc
  1136. (executeInternal): Use peerInteraction->checkRequestSlot(). Added
  1137. calls to checkHave() and sendKeepAlive().
  1138. (keepAlive): Renamed to sendKeepAlive().
  1139. (sendKeepAlive): New function.
  1140. (beforeSocketCheck): Removed.
  1141. (checkHave): New function.
  1142. * src/BitfieldMan.cc
  1143. (getMissingIndex): Don't call getMissingIndexRandomly() if max is 0.
  1144. (getMissingUnusedIndex): Don't call getMissingIndexRandomly() if max is
  1145. 0.
  1146. (getMissingIndex): Dont't call getMissingIndexRandomly() if max is 0.
  1147. * src/TorrentMan.h
  1148. (UsedPieces): Removed.
  1149. (Pieces): New type definition.
  1150. * src/Piece.h: Updated doc.
  1151. * src/Peer.h
  1152. (totalLength): Removed.
  1153. * src/Peer.cc
  1154. (updateLatency): Fixed the latency calculation.
  1155. * src/TorrentMan.cc
  1156. (addPeer): Call deleteOldErrorPeers() only if peers.size() is higher
  1157. than or equal to MAX_PEER_LIST_SIZE.
  1158. If duplicate is false and peer.size() >= MAX_PEER_LIST_SIZE,
  1159. then return false.
  1160. (deleteOldErrorPeers): Rewritten.
  1161. (deleteUsedPiece): Fixed the miss use of STL remove.
  1162. * src/PeerInteraction.h
  1163. (Pieces): Removed.
  1164. (deleteTimeoutRequestSlot): Removed.
  1165. (deleteCompletedRequestSlot): Removed.
  1166. (checkRequestSlot): New function.
  1167. * src/PeerInteraction.cc
  1168. (deleteTimeoutRequestSlot): Merged to checkRequestSlot().
  1169. (deleteCompletedRequestSlot): Merged to checkRequestSlot().
  1170. (checkRequestSlot): New function.
  1171. * src/DownloadEngine.cc
  1172. (run): Clear activeSockets before calling waitData().
  1173. (waitData): Removed a call to activeSockets.clear().
  1174. 2006-05-24 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  1175. To attempt to handle EINTR:
  1176. * src/SocketCore.cc
  1177. (isReadable): Added EINTR handling.
  1178. (isWritable): Added EINTR handling.
  1179. To improve the performance:
  1180. * src/AbstractCommand.cc
  1181. (isTimeoutDetected): Use Util::difftvsec() instead of Util::difftv().
  1182. * src/PeerInteractionCommand.h
  1183. (receiveMessage): Renamed as receiveMessages().
  1184. (receiveMessages): New function.
  1185. * src/PeerInteractionCommand.cc
  1186. (executeInternal): receiveMessage loop is moved to new receiveMessages
  1187. () function. detectMessageFlooding() is moved here.
  1188. (detectMessageFlooding): Use Util::difftvsec() instead of Util::difftv
  1189. (). The flooding detection for have message is comment out.
  1190. (checkLongTimePeerChoking): Use Util::difftvsec() instead of
  1191. Util::difftv().
  1192. (receiveMessage): Renamed as receiveMessages().
  1193. (receiveMessages): New function.
  1194. (keepAlive): Use Util::difftvsec() instead of Util::difftv().
  1195. (beforeSocketCheck): Commented out checkLongTimePeerChoking().
  1196. * src/SleepCommand.cc
  1197. (execute): Use Util::difftvsec() instead of Util::difftv().
  1198. * src/BitfieldMan.h
  1199. (getNthBitIndex): New function.
  1200. (hasMissingPiece): New function.
  1201. (getAllMissingIndexes): New function.
  1202. * src/BitfieldMan.cc
  1203. (countSetBit): Rewritten.
  1204. (getNthBitIndex): New function.
  1205. (getMissingIndexRandomly): Rewritten.
  1206. (hasMissingPiece): New function.
  1207. (getAllMissingIndexes): New function.
  1208. * src/TorrentMan.cc
  1209. (hasMissingPiece): New function.
  1210. (deleteUsedPiece): Rewritten using STL.
  1211. * src/PeerInteraction.cc
  1212. (getNewPieceAndSendInterest): Use TorrentMan::hasMissingPiece(), which
  1213. is a little bit faster then TorrentMan::getMissingPieceIndex().
  1214. (addRequests): Updated the number of pending requests.
  1215. * src/PeerAbstractCommand.cc
  1216. (isTimeoutDetected): Use Util::difftvsec() instead of Util::difftv().
  1217. (execute): Returns true if TorrentMan::isHalt() is true.
  1218. Corrected the condition of upload limit checking.
  1219. * src/Util.h
  1220. (countBit): New function.
  1221. * src/Util.cc
  1222. (nbits): New variable.
  1223. (countBit): New function.
  1224. * src/DownloadEngine.h
  1225. (SockCmdMap): New type definition.
  1226. (waitData): Added an argument.
  1227. (addSocket): Added an argument.
  1228. (addSocketForReadCheck): Added an argument.
  1229. (addSocketForWriteCheck): Added an argument.
  1230. * src/DownloadEngine.cc
  1231. (run): Executes only commands whose sockets are ready to read or write.
  1232. All commands are executed in every 1 second.
  1233. (waitData): Calls select() again if it returned
  1234. EINTR.
  1235. (addSocket): Saves socket and command object pair to the map.
  1236. (deleteSocket): Deletes socket and command object pair from the map.
  1237. (addSocketForReadCheck): Added an argument.
  1238. (addSocketForWriteCheck): Added an argument.
  1239. * src/DownloadCommand.cc
  1240. (executeInternal): Use Util::difftvsec() instead of Util::difftv().
  1241. To send "event=stopped" to the tracker when the application finishes:
  1242. * src/PeerChokeCommand.h
  1243. (checkPoint): New variable.
  1244. * src/PeerChokeCommand.cc
  1245. (PeerChokeCommand): Added the initialization of checkPoint.
  1246. (execute): The interval check is now done by checkPoint, not
  1247. SleepCommand. Return true if TorrentMan::isHalt() is true.
  1248. * src/TorrentMan.h
  1249. (halt): New function.
  1250. (hasMissingPiece): New function.
  1251. (isHalt): New function.
  1252. (setHalt): New function.
  1253. * src/TorrentMan.cc
  1254. (TorrentMan): Added the initialization of halt.
  1255. * src/TorrentAutoSaveCommand.h
  1256. (checkPoint): New variable.
  1257. * src/PeerListenCommand.cc
  1258. (execute): Returns true if TorrentMan::isHalt() is true.
  1259. * src/main.cc
  1260. (setSignalHander): Added flags argument.
  1261. (torrentHandler): Just calls TorrentMan::setHalt(true) and returns.
  1262. (main): Set SA_ONESHOT flag of the signal hander of SIGINT and SIGTERM.
  1263. Removed printDownloadAbortMessage() after torrent downloading loop.
  1264. * src/TorrentAutoSaveCommand.cc
  1265. (TorrentAutoSaveCommand): Added the initialization of checkPoint.
  1266. (execute): Returns true if TorrentMan::isHalt() is true.
  1267. The interval check is now done by checkPoint, not SleepCommand.
  1268. * src/TrackerWatcherCommand.cc
  1269. (execute): If TorrentMan::isHalt(), then create a tracker request with
  1270. event=stopped.
  1271. * src/TrackerUpdateCommand.cc
  1272. (prepareForRetry): Do not use SleepCommand here.
  1273. (execute): Returns true if TorrentMan::isHalt() is true.
  1274. Others:
  1275. * src/TorrentMan.cc
  1276. (getMissingPieceIndex): Updated log message.
  1277. * src/PeerInteraction.cc
  1278. (createPeerMessag): Updated log message.
  1279. 2006-05-20 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  1280. To add the ability to download several pieces in mix in a command and
  1281. increase the number of request slots according to request-cancel
  1282. latency:
  1283. * src/PeerInteractionCommand.cc
  1284. (executeInternal): The number of messages to be received at a time
  1285. is increased from 10 to 50.
  1286. * src/LogFactory
  1287. (getInstance): Added NullLogger.
  1288. * src/NullLogger.h: New class.
  1289. * src/BitfieldMan.h
  1290. (getMissingIndex): New function.
  1291. * src/BitfieldMan.cc
  1292. (getMissingIndex): New function.
  1293. * src/TorrentMan.h
  1294. (checkOutPiece): New function.
  1295. (getMissingPieceIndex): New function.
  1296. (getMissingFastPieceIndex): New function.
  1297. (getMissingFastPiece): New function.
  1298. * src/TorrentMan.cc
  1299. (updatePiece): Rewritten using STL.
  1300. (syncPiece): Rewritten using STL.
  1301. (getMissingPiece): Rewritten using getMissingPieceIndex() and
  1302. checkOutPiece().
  1303. (getMissingPieceIndex): New function.
  1304. (getMissingFastPieceIndex): New function.
  1305. (getMissingFastPiece): New function.
  1306. (checkOutPiece): New function.
  1307. * src/PeerInteraction.h
  1308. (Pieces): New type definition.
  1309. (piece): Removed.
  1310. (pieces): New variable.
  1311. (getNewPieceAndSendInterest): Added the "piece" argument.
  1312. (abortPiece): Added the "piece" argument.
  1313. (abortAllPieces): New function.
  1314. (isInRequestSlot): New function.
  1315. (hasDownloadPiece): Added the "index" argument.
  1316. (setDownloadPiece): Removed.
  1317. (getDownloadPiece): Added the "index" argument.
  1318. (updatePiece): New function.
  1319. (createRequestMessage): Added the "index" argument.
  1320. * src/PeerInteraction.cc
  1321. (onChoked): Rewritten.
  1322. (abortPiece): Rewirtten.
  1323. (abortAllPieces): New function.
  1324. (deleteTimeoutRequestSlot): Rewritten.
  1325. Clarified code a little bit.
  1326. (deleteCompletedRequestSlot): Rewritten.
  1327. (isInRequestSlot): New function.
  1328. (syncPiece): Rewritten.
  1329. (updatePiece): New function.
  1330. (getNewPieceAndSendInterest): Rewritten.
  1331. (addRequests): Rewritten.
  1332. (getDownloadPiece): Rewritten.
  1333. (hasDownloadPiece): Rewritten.
  1334. (createRequestMessage): Added the "index" argument.
  1335. * src/common.h
  1336. (BITFIELD_LEN_FROM_PIECES): Enclosed the variable in parentheses.
  1337. (DIV_FLOOR): New definition.
  1338. * src/PieceMessage.cc
  1339. (receivedAction): Update request-piece latency here.
  1340. * src/RequestSlot.h
  1341. (getLatencyInMillis): New function.
  1342. * src/RequestSlot.cc
  1343. (isTimeout): Rewritten using getLatencyInMillis.
  1344. (getLatencyInMillis): New function.
  1345. * src/Piece.h
  1346. (operator==): New function.
  1347. (getMissingBlockIndex): New function.
  1348. * src/Piece.cc
  1349. (operator==): New function.
  1350. (getMissingBlockIndex): New function.
  1351. * src/Peer.h
  1352. (DEFAULT_LATENCY): New definition.
  1353. (latency): New variable.
  1354. (updateLatency): New function.
  1355. (getLatency): New function.
  1356. * src/Peer.cc
  1357. (resetStatus): Reset latecy.
  1358. (updateLatency): New function.
  1359. 2006-05-20 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  1360. * src/SocketCore.cc
  1361. (isReadable): Added secure to the condition.
  1362. * src/HttpConnection.cc
  1363. (receiveResponse): Fixed a bug that causes no response header
  1364. exception.
  1365. * src/Peer.h
  1366. (getFastSet): Fixed the return value type.
  1367. 2006-05-18 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  1368. To remove a wait from download loop:
  1369. * src/DownloadEngine.cc
  1370. (run): Comment out shortSleep.
  1371. To rewrite the message handling:
  1372. * src/SimplePeerMessage.h: New class.
  1373. * src/SimplePeerMessage.cc: New class.
  1374. * src/CancelMessage.h: Derived from SimplePeerMessage.
  1375. (msg): New variable.
  1376. (create): New function.
  1377. (send): Removed.
  1378. (getMessage): New function.
  1379. (getMessageLength): New function.
  1380. * src/CancelMessage.cc
  1381. (create): New function.
  1382. (receivedAction): Replaced deleteRequestMessageInQueue with
  1383. rejectPieceMessageInQueue.
  1384. (send): Removed.
  1385. (getMessage): New function.
  1386. (getMessageLength): New function.
  1387. * src/BitfieldMessage.h: Derived from SimplePeerMessage.
  1388. (msg): New variable.
  1389. (msgLength): New variable.
  1390. (~BitfieldMessage): Deleted msg.
  1391. (send): Removed.
  1392. (getMessage): New function.
  1393. (getMessageLength): New function.
  1394. * src/BitfieldMessage.cc
  1395. (create): New function.
  1396. (send): Removed.
  1397. (getMessage): New function.
  1398. (getMessageLength): New function.
  1399. * src/ChokeMessage.h: Derived from SimplePeerMessage.
  1400. (msg): New variable.
  1401. (sendPredicate): New function.
  1402. (onSendComplete): New function.
  1403. (send): Removed.
  1404. (getMessage): New function.
  1405. (getMessageLength): New function.
  1406. (create): New function.
  1407. * src/ChokeMessage.cc
  1408. (create): New function.
  1409. (send): Removed.
  1410. (sendPredicate): New function.
  1411. (getMessage): New function.
  1412. (getMessageLength): New function.
  1413. (onSendComplete): New function.
  1414. * src/KeepAliveMessage.h: Derived from SimplePeerMessage.
  1415. (msg): New variable.
  1416. (send): Removed.
  1417. (getMessage): New function.
  1418. (getMessageLength): New function.
  1419. * src/KeepAliveMessage.cc
  1420. (send): Removed.
  1421. (getMessage): New function.
  1422. (getMessageLength): New function.
  1423. * src/PortMessage.h
  1424. (create): New function.
  1425. (receivedAction): Updated log message.
  1426. * src/PortMessage.cc: New file.
  1427. * src/UnchokeMessage.h: Derived from SimplePeerMessage.
  1428. (msg): New variable.
  1429. (sendPredicate): New function.
  1430. (onSendComplete): New function.
  1431. (create): New function.
  1432. (send): Removed.
  1433. (getMessage): New function.
  1434. (getMessageLength): New function.
  1435. * src/UnchokeMessage.cc
  1436. (create): New function.
  1437. (send): Removed.
  1438. (sendPredicate): New function.
  1439. (getMessage): New function.
  1440. (getMessageLength): New function.
  1441. (onSendComplete): New function.
  1442. * src/PieceMessage.h
  1443. (leftPieceDataLength): Removed.
  1444. (leftDataLength): New variable.
  1445. (headerSend): New variable.
  1446. (pendingCount): New variable.
  1447. (msgHeader): New variable.
  1448. (sendPieceData): New function.
  1449. (incrementPendingCount): New function.
  1450. (isPendingCountMax): New function.
  1451. (create): New function.
  1452. (getMessageHeader): New function.
  1453. (getMessageHeaderLength): New function.
  1454. * src/PieceMessage.cc
  1455. (create): New function.
  1456. (getMessageHeader): New function.
  1457. (getMessageHeaderLength): New function.
  1458. (send): Rewritten.
  1459. (sendPieceData): New function.
  1460. * src/HaveMessage.h: Derived from SimplePeerMessage.
  1461. (msg): New variable.
  1462. (create): New function.
  1463. (getMessage): New function.
  1464. (getMessageLength): New function.
  1465. * src/HaveMessage.cc
  1466. (create): New function.
  1467. (send): Removed.
  1468. (sendPieceData): New function.
  1469. (getMessage): New function.
  1470. (getMessageLength): New function.
  1471. * src/RequestMessage.h: Derived from SimplePeerMessage.
  1472. (msg): New variable.
  1473. (create): New function.
  1474. (send): Removed.
  1475. (getMessage): New function.
  1476. (getMessageLength): New function.
  1477. * src/RequestMessage.cc
  1478. (create): New function.
  1479. (receivedAction): Added the handling of fast extension.
  1480. Deleted torrentMan->addUploadLength, torrentMan->addDeltaUploadLength.
  1481. (send): Removed.
  1482. (getMessage): New function.
  1483. (getMessageLength): New function.
  1484. * src/InterestedMessage.h: Derived from SimplePeerMessage.
  1485. (msg): New variable.
  1486. (sendPredicate): New function.
  1487. (onSendComplete): New function.
  1488. (create): New function.
  1489. (getMessage): New function.
  1490. (getMessageLength): New function.
  1491. * src/InterestedMessage.cc
  1492. (create): New function.
  1493. (send): Removed.
  1494. (sendPieceData): New function.
  1495. (getMessage): New function.
  1496. (getMessageLength): New function.
  1497. (onSendComplete): New function.
  1498. * src/NotInterestedMessage.h: Derived from SimplePeerMessage.
  1499. (msg): New variable.
  1500. (sendPieceData): New function.
  1501. (onSendComplete): New function.
  1502. (create): New function.
  1503. (send): Removed.
  1504. (getMessage): New function.
  1505. (getMessageLength): New function.
  1506. * src/NotInterestedMessage.cc
  1507. (create): New function.
  1508. (send): Removed.
  1509. (sendPredicate): New function.
  1510. (getMessage): New function.
  1511. (getMessageLength): New function.
  1512. (onSendComplete): New function.
  1513. * src/AllowedFastMessage.h: New class.
  1514. * src/AllowedFastMessage.cc: New class.
  1515. * src/RejectMessage.h: New class.
  1516. * src/RejectMessage.cc: New class.
  1517. * src/SuggestPieceMessage.h: New class.
  1518. * src/SuggestPieceMessage.cc: New class.
  1519. * src/HaveAllMessage.h: New class.
  1520. * src/HaveAllMessage.cc: New class.
  1521. * src/HaveNoneMessage.h: New class.
  1522. * src/HaveNoneMessage.cc: New class.
  1523. * src/HandshakeMessage.h: Derived from SimplePeerMessage.
  1524. (msg): New variable.
  1525. (reserved): New variable.
  1526. (create): New function.
  1527. (getId): New function.
  1528. (receivedAction): New function.
  1529. (getMessage): New function.
  1530. (getMessageLength): New function.
  1531. (isFastExtensionSupported): New function.
  1532. * src/HandshakeMessage.cc
  1533. (HandshakeMessage): Moved here from HandshakeMessage.h.
  1534. (create): New function.
  1535. (getMessage): New function.
  1536. (getMessageLength): New function.
  1537. (toString): Added the output of reserved field.
  1538. (check): Added const qualifier.
  1539. (isFastExtensionSupported): New function.
  1540. * src/PeerMessageUtil.h
  1541. (createChokeMessage): Removed.
  1542. (createUnchokeMessage): Removed.
  1543. (createInterestedMessage): Removed.
  1544. (createNotInterestedMessage): Removed.
  1545. (createHaveMessage): Removed.
  1546. (createBitfieldMessage): Removed.
  1547. (createRequestMessage): Removed.
  1548. (createCancelMessage): Removed.
  1549. (createPieceMessage): Removed.
  1550. (createPortMessage): Removed.
  1551. (createChokeMessage): Removed.
  1552. (createUnchokeMessage): Removed.
  1553. (createInterestedMessage): Removed.
  1554. (createNotInterestedMessage): Removed.
  1555. (createHaveMessage): Removed.
  1556. (createBitfieldMessage): Removed.
  1557. (createRequestMessage): Removed.
  1558. (createCancelMessage): Removed.
  1559. (createPieceMessage): Removed.
  1560. (createKeepAliveMessage): Removed.
  1561. (createHandshakeMessage): Removed.
  1562. (setIntParam): New function.
  1563. (createPeerMessageString): New function.
  1564. * src/PeerMessageUtil.cc
  1565. (createChokeMessage): Removed.
  1566. (createUnchokeMessage): Removed.
  1567. (createInterestedMessage): Removed.
  1568. (createNotInterestedMessage): Removed.
  1569. (createHaveMessage): Removed.
  1570. (createBitfieldMessage): Removed.
  1571. (createRequestMessage): Removed.
  1572. (createCancelMessage): Removed.
  1573. (createPieceMessage): Removed.
  1574. (createPortMessage): Removed.
  1575. (createRequestMessage): Removed.
  1576. (createCancelMessage): Removed.
  1577. (createPieceMessage): Removed.
  1578. (createHaveMessage): Removed.
  1579. (createChokeMessage): Removed.
  1580. (createUnchokeMessage): Removed.
  1581. (createInterestedMessage): Removed.
  1582. (createNotInterestedMessage): Removed.
  1583. (createBitfieldMessage): Removed.
  1584. (createKeepAliveMessage): Removed.
  1585. (createHandshakeMessage): Removed.
  1586. (setIntParam): New function.
  1587. (createPeerMessageString): New function.
  1588. * src/PeerConnection.h
  1589. (peer): Removed.
  1590. (torrentMan): Removed.
  1591. (createNLengthMessage): Removed.
  1592. (setIntParam): Removed.
  1593. (writeOutgoingMessageLog): Removed all overloaded functions.
  1594. (PeerConnection): Deleted peer and torrentMan from its arguments.
  1595. (sendMessage): New function.
  1596. (sendHandshake): Removed.
  1597. (sendKeepAlive): Removed.
  1598. (sendChoke): Removed.
  1599. (sendUnchoke): Removed.
  1600. (sendInterested): Removed.
  1601. (sendNotInterested): Removed.
  1602. (sendHave): Removed.
  1603. (sendBitfield): Removed.
  1604. (sendRequest): Removed.
  1605. (sendPiece): Removed.
  1606. (sendPieceHeader): Removed.
  1607. (sendPieceData): Removed.
  1608. (sendCancel): Removed.
  1609. (getPeer): Removed.
  1610. * src/PeerConnection.cc
  1611. (PeerConnection): Deleted peer and torrentMan from its arguments.
  1612. (sendHandshake): Removed.
  1613. (sendKeepAlive): Removed.
  1614. (createNLengthMessage): Removed.
  1615. (setIntParam): Removed.
  1616. (writeOutgoingMessageLog): Removed all overloaded functions.
  1617. (sendChoke): Removed.
  1618. (sendUnchoke): Removed.
  1619. (sendInterested): Removed.
  1620. (sendNotInterested): Removed.
  1621. (sendHave): Removed.
  1622. (sendBitfield): Removed.
  1623. (sendRequest): Removed.
  1624. (sendPiece): Removed.
  1625. (sendPieceHeader): Removed.
  1626. (sendPieceData): Removed.
  1627. (sendMessage): New function.
  1628. (sendCancel): Removed.
  1629. * src/PeerInteractionCommand.cc
  1630. (PeerInteractionCommand): Call setUploadLimit.
  1631. (executeInternal): Call setUploadLimit.
  1632. Added the handling of "inProgress" state of handshake message.
  1633. Call sendBitfield() or sendAllowdFast() instead of deprecated
  1634. sendNow().
  1635. (keepAlive): Call addMessage and sendMessage instead of deprecated
  1636. sendNow().
  1637. (beforeSocketCheck): Call addMessage instead of deprecated trySendNow()
  1638. * src/TorrentMan.h
  1639. (PEER_ID_LENGTH): New definition.
  1640. (hasAllPieces): New function.
  1641. * src/TorrentMan.cc
  1642. (getMissingPiece): Added the handling of fast extension.
  1643. (cancelPiece): Call updatePiece().
  1644. (hasAllPieces): New function.
  1645. * src/PeerInteraction.h
  1646. (fastSet): New variable.
  1647. (getNewPieceAndSendInterest): Changed the return type to void.
  1648. (send): Renamed as sendMessages.
  1649. (deleteAllRequestSlot): Removed.
  1650. (deleteRequestMessageInQueue): Renamed as rejectPieceMessageInQueue.
  1651. (cancelAllRequest): Removed all overloaded functions.
  1652. (deleteAllRequestSlot): Removed.
  1653. (deletePieceMessageInQueue): Renamed as rejectAllPieceMessageInQueue.
  1654. (rejectPieceMessageInQueue): New function.
  1655. (rejectAllPieceMessageInQueue): New function.
  1656. (onChoked): New function.
  1657. (isSendingMessageInProgress): New function.
  1658. (getCorrespondingRequestSlot): Changed its arguments.
  1659. (isInFastSet): New function.
  1660. (addFastSetIndex): New function.
  1661. (addRequests): New function.
  1662. (sendNow): Removed.
  1663. (trySendNow): Removed.
  1664. (sendBitfield): New function.
  1665. (sendAllowdFast): New function.
  1666. (createHaveAllMessage): New function.
  1667. (createHaveNoneMessage): New function.
  1668. (createRejectMessage): New function.
  1669. (createAllowedFastMessage): New function.
  1670. * src/PeerInteraction.cc
  1671. (send): Renamed as sendMessages.
  1672. (sendMessages): New function.
  1673. (MsgPushBack): New class.
  1674. (isSendingMessageInProgress): New function.
  1675. (deletePieceMessageInQueue): Renamed as rejectAllPieceMessageInQueue.
  1676. (rejectAllPieceMessageInQueue): New function.
  1677. Added the handling of fast extension.
  1678. (deleteRequestMessageInQueue): Renamed as rejectPieceMessageInQueue.
  1679. (rejectPieceMessageInQueue): New function.
  1680. Added the handling of fast extension.
  1681. (deleteRequestSlot): Replaced for loop with std::find.
  1682. (onChoked): New function.
  1683. (deleteAllRequestSlot): Removed.
  1684. (abortPiece): Rewirtten.
  1685. (deleteTimeoutRequestSlot): Updated log messages.
  1686. (getCorrespondingRequestSlot): Changed its arguments.
  1687. (cancelAllRequest): Removed all overloaded functions.
  1688. (receiveHandshake): Added the check to see whether an incoming peer
  1689. supports fast extension.
  1690. (createHandshakeMessage): Use HandshakeMessage::create instead of
  1691. PeerMessageUtil.
  1692. (createPeerMessage): Use create() of each message class instead of
  1693. PeerMessageUtil.
  1694. HaveAllMessage, HaveNoneMessage, RejectMessage, SuggestPieceMessage,
  1695. AllowedFastMessage were added.
  1696. (getNewPieceAndSendInterest): Changed its return value type to void.
  1697. Added the handling of fast extension.
  1698. (addRequests): New function.
  1699. (sendNow): Removed.
  1700. (sendHandshake): Rewritten.
  1701. (trySendNow): Removed.
  1702. (sendBitfield): New function.
  1703. (sendAllowdFast): New function.
  1704. (isInFastSet): New function.
  1705. (addFastSetIndex): New function.
  1706. (createRequestMessage): Use RequestMessage::create instead of
  1707. PeerMessageUtil.
  1708. (createCancelMessage): Use CancelMessage::create instead of
  1709. PeerMessageUtil.
  1710. (createPieceMessage): Use PieceMessage::create instead of
  1711. PeerMessageUtil.
  1712. (createHaveMessage): Use HaveMessage::create instead of
  1713. PeerMessageUtil.
  1714. (createChokeMessage): Use ChokeMessage::create instead of
  1715. PeerMessageUtil.
  1716. (createUnchokeMessage): Use UnchokeMessage::create instead of
  1717. PeerMessageUtil.
  1718. (createInterestedMessage): Use InterestedMessage::create instead of
  1719. PeerMessageUtil.
  1720. (createNotInterestedMessage): Use NotInterestedMessage::create instead
  1721. of PeerMessageUtil.
  1722. (createBitfieldMessage): Use BitfieldMessage::create instead of
  1723. PeerMessageUtil.
  1724. (createKeepAliveMessage): Use KeepAliveMessage::create instead of
  1725. PeerMessageUtil.
  1726. (createHaveAllMessage): New function.
  1727. (createHaveNoneMessage): New function.
  1728. (createRejectMessage): New function.
  1729. (createAllowedFastMessage: New function.
  1730. * src/Util.h
  1731. (sha1Sum): New function.
  1732. (computeFastSet): New function.
  1733. * src/Util.cc
  1734. (sha1Sum): New function.
  1735. (computeFastSet): New function.
  1736. * src/Peer.h
  1737. (fastExtensionEnabled): New variable.
  1738. (fastSet): New variable.
  1739. (setAllBitfield): New function.
  1740. (setFastExtensionEnabled): New function.
  1741. (isFastExtensionEnabled): New function.
  1742. (addFastSetIndex): New function.
  1743. (getFastSet): New function.
  1744. (isInFastSet): New function.
  1745. (countFastSet): New function.
  1746. * src/Peer.cc
  1747. (isInFastSet): New function.
  1748. (addFastSetIndex): New function.
  1749. (setAllBitfield): New function.
  1750. * src/AbstractCommand.cc (execute): Changed the procedure of checking
  1751. sockets.
  1752. * src/PeerAbstractCommand.cc
  1753. (PeerAbstractCommand): Added the initialization for uploadLimitCheck
  1754. and uploadLimit.
  1755. (execute): Changed the procedure of checking sockets. The upload speed
  1756. checking were added.
  1757. (setUploadLimit): New function.
  1758. (setUploadLimitCheck): New function.
  1759. * src/PeerAbstractCommand.h
  1760. (setUploadLimit): New function.
  1761. (setUploadLimitCheck): New function.
  1762. (uploadLimit): New variable.
  1763. (uploadLimitCheck): New variable.
  1764. To contact a tracker regularly:
  1765. * src/TrackerWatcherCommand.h (interval): New variable.
  1766. (checkPoint): New variable.
  1767. (TrackerWatcherCommand): Added interval argument.
  1768. * src/TrackerWatcherCommand.cc
  1769. (TrackerWatcherCommand): Initialized checkPoint.
  1770. (execute): Now a tracker is contacted in every specified period.
  1771. If peer list is not needed, send request with numwant=0.
  1772. * src/TrackerUpdateCommand.cc
  1773. (execute): Updated log messages.
  1774. * src/DownloadEngine.cc
  1775. (~DownloadEngine): Removed two asserts.
  1776. (waitData): Uncommented wfds. May be a bug fix.
  1777. 2006-05-10 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  1778. * src/PeerInteractionCommand.h
  1779. (checkInactiveConnection): Removed.
  1780. * src/PeerInteractionCommand.cc
  1781. (executeInternal): Removed following function calls:
  1782. detectMessageFlooding(), checkLongTimePeerChoking and
  1783. checkInactiveConnection().
  1784. (checkInactiveConnection): Removed.
  1785. (detectMessageFlooding): Removed function call to
  1786. checkInactiveConnection().
  1787. * src/PeerMessageUtil.h
  1788. (createChokeMessage): New function. Overload.
  1789. (createUnchokeMessage): New function. Overload.
  1790. (createInterestedMessage): New function. Overload.
  1791. (createNotInterestedMessage): New function. Overload.
  1792. (createHaveMessage): New function. Overload.
  1793. (createBitfieldMessage): New function. Overload.
  1794. (createRequestMessage): New function. Overload.
  1795. (createCancelMessage): New function. Overload.
  1796. (createPieceMessage): New function. Overload.
  1797. (createKeepAliveMessage): New function. Overload.
  1798. * src/PeerMessageUtil.cc
  1799. (createChokeMessage): New function. Overload.
  1800. (createUnchokeMessage): New function. Overload.
  1801. (createInterestedMessage): New function. Overload.
  1802. (createNotInterestedMessage): New function. Overload.
  1803. (createHaveMessage): New function. Overload.
  1804. (createBitfieldMessage): New function. Overload.
  1805. (createRequestMessage): New function. Overload.
  1806. (createCancelMessage): New function. Overload.
  1807. (createPieceMessage): New function. Overload.
  1808. (createKeepAliveMessage): New function. Overload.
  1809. * src/SendMessageQueue.cc
  1810. (createRequestMessage): Use PeerMessageUtil.
  1811. (createCancelMessage): Use PeerMessageUtil.
  1812. (createPieceMessage): Use PeerMessageUtil.
  1813. (createHaveMessage): Use PeerMessageUtil.
  1814. (createChokeMessage): Use PeerMessageUtil.
  1815. (createUnchokeMessage): Use PeerMessageUtil.
  1816. (createInterestedMessage): Use PeerMessageUtil.
  1817. (createNotInterestedMessage): Use PeerMessageUtil.
  1818. (createBitfieldMessage): Use PeerMessageUtil.
  1819. (createKeepAliveMessage): Use PeerMessageUtil.
  1820. * src/SendMessageQueue.h: Renamed to PeerInteraction.h
  1821. * src/SendMessageQueue.cc: Renamed to PeerInteraction.cc
  1822. * src/PeerInteraction.h: New class.
  1823. * src/PeerInteraction.cc: New class.
  1824. 2006-05-09 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  1825. Each peer message has its own class.
  1826. * src/PendingMessages.h: Removed.
  1827. * src/PendingMessages.cc: Removed. The sending process was moved to
  1828. each message class.
  1829. * src/RequestSlotMan.h: Removed.
  1830. * src/RequestSlotMan.cc: Removed. All functionarities were moved to
  1831. SendMessageQueue.
  1832. * src/RequestMessage.h: New class.
  1833. * src/RequestMessage.cc: New class.
  1834. * src/CancelMessage.h: New class.
  1835. * src/CancelMessage.cc: New class.
  1836. * src/BitfieldMessage.h: New class.
  1837. * src/BitfieldMessage.cc: New class.
  1838. * src/ChokeMessage.h: New class.
  1839. * src/ChokeMessage.cc: New class.
  1840. * src/KeepAliveMessage.h: New class.
  1841. * src/KeepAliveMessage.cc: New class.
  1842. * src/PortMessage.h: New class.
  1843. * src/UnchokeMessage.h: New class.
  1844. * src/UnchokeMessage.cc: New class.
  1845. * src/PieceMessage.h: New class.
  1846. * src/PieceMessage.cc: New class.
  1847. * src/HaveMessage.h: New class.
  1848. * src/HaveMessage.cc: New class.
  1849. * src/BitfieldMessage.h: New class.
  1850. * src/BitfieldMessage.cc: New class.
  1851. * src/NotInterestedMessage.h: New class.
  1852. * src/NotInterestedMessage.cc: New class.
  1853. * src/InterestedMessage.h: New class.
  1854. * src/InterestedMessage.cc: New class.
  1855. * src/HandshakeMessage.h (sendMessageQueue): New variable.
  1856. (getSendMessageQueue): New function.
  1857. (setSendMessageQueue): New function.
  1858. * src/HandshakeMessage.cc: New class.
  1859. * src/PeerConnection.h (receiveMessage): Changed return value and
  1860. arguments.
  1861. (receiveHandshake): Changed return value and arguments.
  1862. * src/PeerConnection.cc (receiveMessage): Do not create message class
  1863. here.
  1864. (receiveHandshake): Do not create handshake class here.
  1865. * src/PeerInteractionCommand.h (peerConnection): Removed.
  1866. (piece): Removed.
  1867. (syncPiece): Removed.
  1868. (sendInterest): Removed.
  1869. (sendMessages): Removed.
  1870. (createRequestPendingMessage): Removed.
  1871. (checkPieceHash): Removed.
  1872. (erasePieceOnDisk): Removed.
  1873. (getNewPieceAndSendInterest): Removed.
  1874. (onGotNewPice): Removed.
  1875. (onGotWrongPiece): Removed.
  1876. * src/PeerInteractionCommand.cc (PeerInteractionCommand):
  1877. Removed peerConnection, piece.
  1878. (~PeerInteractionCommand): Removed peerConnection.
  1879. (executeInternal): Use sendMessageQueue instead of peerConnection.
  1880. (syncPiece): Moved to SendMessageQueue.
  1881. (decideChoking): Removed PendingMessage.
  1882. (receiveMessage): Use sendMessageQueue instead of peerConnection.
  1883. The action after receiving peer message was moved to each message
  1884. class.
  1885. (onGotNewPice): Moved to SendMessageQueue.
  1886. (onGotWrongPiece): Moved to SendMessageQueue.
  1887. (getNewPieceAndSendInterest): Moved to SendMessageQueue.
  1888. (sendInterest): Moved to SendMessageQueue.
  1889. (createRequestPendingMessage): Removed.
  1890. (sendMessages): Moved to SendMessageQueue.
  1891. (onAbort): Use SendMessageQueue::abortPiece()
  1892. (keepAlive): Use sendMessageQueue instead of peerConnection.
  1893. (beforeSocketCheck): Use sendMessageQueue instead of peerConnection.
  1894. (checkPieceHash): Moved to SendMessageQueue.
  1895. (erasePieceOnDisk): Moved to SendMessageQueue.
  1896. * src/PeerMessageUtil.h
  1897. (createBitfieldMessage): Removed.
  1898. (createHaveMessage): Changed return value and arguments.
  1899. (createBitfieldMessage): Changed return value and arguments.
  1900. (createRequestCancelMessage): Removed.
  1901. (createPieceMessage): Changed return value and arguments.
  1902. (getShortIntParam): New function.
  1903. (checkIndex): Changed arguments.
  1904. (checkBegin): Changed arguments.
  1905. (checkLength): Changed arguments.
  1906. (checkPieceOffset): Removed.
  1907. (checkRange): New function.
  1908. (checkBitfield): Changed arguments.
  1909. (createPeerMessage): Removed.
  1910. (checkIntegrity): Removed.
  1911. (createHandshakeMessage): Changed arguments.
  1912. (createChokeMessage): New function.
  1913. (createUnchokeMessage): New function.
  1914. (createInterestedMessage): New function.
  1915. (createNotInterestedMessage): New function.
  1916. (createRequestMessage): New function.
  1917. (createCancelMessage): New function.
  1918. (createPortMessage): New function.
  1919. * src/PeerMessageUtil.cc
  1920. (createBitfieldMessage): Removed.
  1921. (createHaveMessage): Changed return value and arguments.
  1922. (createBitfieldMessage): Changed return value and arguments.
  1923. (createRequestCancelMessage): Removed.
  1924. (createPieceMessage): Changed return value and arguments.
  1925. (getShortIntParam): New function.
  1926. (checkIndex): Changed arguments.
  1927. (checkBegin): Changed arguments.
  1928. (checkLength): Changed arguments.
  1929. (checkPieceOffset): Removed.
  1930. (checkRange): New function.
  1931. (checkBitfield): Changed arguments.
  1932. (createPeerMessage): Removed.
  1933. (checkIntegrity): Removed.
  1934. (createHandshakeMessage): Changed arguments.
  1935. (createChokeMessage): New function.
  1936. (createUnchokeMessage): New function.
  1937. (createInterestedMessage): New function.
  1938. (createNotInterestedMessage): New function.
  1939. (createRequestMessage): New function.
  1940. (createCancelMessage): New function.
  1941. (createPortMessage): New function.
  1942. * src/PeerMessage.h
  1943. (id): Removed.
  1944. (index): Removed.
  1945. (begin): Removed.
  1946. (length): Removed.
  1947. (bitfield): Removed.
  1948. (bitfieldLength): Removed.
  1949. (block): Removed.
  1950. (blockLength): Removed.
  1951. (inProgress): New variable.
  1952. (cuid): New variable.
  1953. (peer): New variable.
  1954. (sendMessageQueue): New variable.
  1955. (logger): New variable.
  1956. (setBitfield): Removed.
  1957. (getBitfield): Removed.
  1958. (setBlock): Removed.
  1959. (getBlock): Removed.
  1960. (getBitfieldLength): Removed.
  1961. (getBlockLength): Removed.
  1962. (isInProgress): New function.
  1963. (toString): Made pure virtual.
  1964. (check): New function.
  1965. (send): New function.
  1966. (receivedAction): New function.
  1967. (getId): Made pure virtual.
  1968. (setId): Removed.
  1969. (getIndex): Removed.
  1970. (setIndex): Removed.
  1971. (getBegin): Removed.
  1972. (setBegin): Removed.
  1973. (getLength): Removed.
  1974. (setLength): Removed.
  1975. (getCuid): New function.
  1976. (setCuid): New function.
  1977. (getPeer): New function.
  1978. (setPeer): New function.
  1979. (getSendMessageQueue): New function.
  1980. (setSendMessageQueue): New function.
  1981. (ID): Removed.
  1982. * src/PeerMessage.cc
  1983. (setBitfield): Removed.
  1984. (setBlock): Removed.
  1985. (toString): Removed.
  1986. * src/TorrentMan.h
  1987. (getPieceLength): New function.
  1988. (getPieceLength): New function.
  1989. * src/SendMessageQueue.h
  1990. (REQUEST_TIME_OUT): New definition.
  1991. (RequestSlots): New definition.
  1992. (MessageQueue): New definition.
  1993. (requestSlotMan): Removed.
  1994. (pendingMessages): Removed.
  1995. (requestSlots): New variable.
  1996. (messageQueue): New variable.
  1997. (torrentMan): New variable.
  1998. (peerConnection): New variable.
  1999. (peer): New variable.
  2000. (piece): New variable.
  2001. (getNewPieceAndSendInterest): New function.
  2002. (createPeerMessage): New function.
  2003. (createHandshakeMessage): New function.
  2004. (send): Made private.
  2005. (setPeerMessageCommonProperty): New function.
  2006. (deleteAllRequestSlot): New function.
  2007. (deleteRequestMessageInQueue): New function.
  2008. (cancelAllRequest): Made private.
  2009. (cancelAllRequest): Made private.
  2010. (countRequestSlot): Made private.
  2011. (addPendingMessage): Removed.
  2012. (deletePendingPieceMessage): Removed.
  2013. (deletePendingRequestMessage): Removed.
  2014. (addMessage): New function.
  2015. (deletePieceMessageInQueue): New function.
  2016. (deleteTimeoutRequestSlot): Changed argument.
  2017. (deleteCompletedRequestSlot): Changed argument.
  2018. (getCorrespoindingRequestSlot): Renamed to getCorrespondingRequestSlot.
  2019. (getCorrespondingRequestSlot): New function.
  2020. (countPendingMessage): Removed.
  2021. (countMessageInQueue): New function.
  2022. (getTorrentMan): New function.
  2023. (getPeerConnection): New function.
  2024. (hasDownloadPiece): New function.
  2025. (getDownloadPiece): New function.
  2026. (setDownloadPiece): New function.
  2027. (syncPiece): New function.
  2028. (sendMessages): New function.
  2029. (sendNow): New function.
  2030. (trySendNow): New function.
  2031. (abortPiece): New function.
  2032. (sendHandshake): New function.
  2033. (receiveMessage): New function.
  2034. (receiveHandshake): New function.
  2035. (createRequestMessage): New function.
  2036. (createCancelMessage): New function.
  2037. (createPieceMessage): New function.
  2038. (createHaveMessage): New function.
  2039. (createChokeMessage): New function.
  2040. (createUnchokeMessage): New function.
  2041. (createInterestedMessage): New function.
  2042. (createNotInterestedMessage): New function.
  2043. (createBitfieldMessage): New function.
  2044. (createKeepAliveMessage): New function.
  2045. * src/SendMessageQueue.cc
  2046. (SendMessageQueue): Removed requestSlotMan.
  2047. Instantiated peerConnection here.
  2048. (~SendMessageQueue): Removed requestSlotMan.
  2049. Added deletion of peerConnection and the contents of messageQueue.
  2050. (send): Updated according to the change of messageQueue.
  2051. (addPendingMessage): Renamed to addMessage.
  2052. (addMessage): New function.
  2053. (deletePendingPieceMessage): Renamed to deletePieceMessageInQueue.
  2054. (deletePieceMessageInQueue): New function.
  2055. (deletePendingRequestMessage): Renamed to deleteRequestMessageInQueue.
  2056. (deleteRequestMessageInQueue): New function.
  2057. (deleteRequestSlot): RequestSlotMan::deleteRequestSlot(...) was moved
  2058. here.
  2059. (deleteTimeoutRequestSlot): RequestSlotMan::deleteTimeoutRequestSlot
  2060. (...) was moved here.
  2061. (deleteAllRequestSlot): RequestSlotMan::deleteAllRequestSlot(...) was
  2062. moved here.
  2063. (deleteCompletedRequestSlot):
  2064. RequestSlotMan::deleteCompletedRequestSlot(...) was moved here.
  2065. (getCorrespondingRequestSlot):
  2066. RequestSlotMan::getCorrespoindingRequestSlot(...) was moved here.
  2067. And renamed to getCorrespondingRequestSlot, correcting a typo.
  2068. (countPendingMessage): Renamed to countMessageInQueue.
  2069. (countMessageInQueue): New function.
  2070. (countRequestSlot): RequestSlotMan::countRequestSlot() was moved here.
  2071. (receiveHandshake): New function.
  2072. (createHandshakeMessage): New function.
  2073. (receiveMessage): New function.
  2074. (createPeerMessage): New function.
  2075. (syncPiece): New function.
  2076. (getNewPieceAndSendInterest): New function.
  2077. (sendMessages): New function.
  2078. (sendNow): New function.
  2079. (trySendNow): New function.
  2080. (sendHandshake): New function.
  2081. (abortPiece): New function.
  2082. (getDownloadPiece): New function.
  2083. (getPeerMessageCommonProperty): New function.
  2084. (createRequestMessage): New function.
  2085. (createCancelMessage): New function.
  2086. (createPieceMessage): New function.
  2087. (createHaveMessage): New function.
  2088. (createChokeMessage): New function.
  2089. (createUnchokeMessage): New function.
  2090. (createInterestedMessage): New function.
  2091. (createNotInterestedMessage): New function.
  2092. (createBitfieldMessage): New function.
  2093. (createKeepAliveMessage): New function.
  2094. To add simple Content-Disposition support:
  2095. * src/HttpResponseCommand.h (determinFilename): New function.
  2096. * src/HttpResponseCommand.cc (executeInternal):
  2097. Use determinFilename(headers) instead of req->getFile() when comparing
  2098. filename.
  2099. (determinFilename): New function.
  2100. (handleDefaultEncoding): Use determinFilename(headers) instead of
  2101. req->getFile().
  2102. (handleOtherEncoding): Use determinFilename(headers) instead of
  2103. req->getFile().
  2104. * src/Util.h (getContentDispositionFilename): New function.
  2105. * src/Util.cc (getContentDispositionFilename): New function.
  2106. * src/LogFactory.h (release): New function.
  2107. * src/LogFactory.cc (release): New function.
  2108. To fix a bug that causes out-of-bound exception when HTTP status
  2109. line is wrong:
  2110. * src/HttpConnection.cc (receiveResponse): Added a check for header
  2111. size.
  2112. * src/common.h (Deleter): New class.
  2113. * src/SegmentMan.cc
  2114. (~SegmentMan): Added deletion of splitter and diskWriter.
  2115. * src/DownloadEngine.h
  2116. (Commands): Use deque.
  2117. (clearQueue): New function.
  2118. * src/DownloadEngine.cc
  2119. (~DownloadEngine): Added deletion of segmentMan.
  2120. (cleanQueue): New function.
  2121. * src/TorrentDownloadEngine.h
  2122. (TorrentDownloadEngine): The implementation was moved to
  2123. TorrentDownloadEngine.cc.
  2124. (~TorrentDownloadEngine): The implementation was moved to
  2125. TorrentDownloadEngine.cc.
  2126. * src/TorrentDownloadEngine.cc
  2127. (~TorrentDownloadEngine): Added deletion of torrentMan.
  2128. * src/main.cc
  2129. (clearRequest): Removed.
  2130. (handler): Added deletion of e.
  2131. (torrentHandler): Added deletion of te.
  2132. (main): Do not share splitter.
  2133. Use Deleter instead of clearRequest.
  2134. Deletion of classes were updated.
  2135. 2006-05-06 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2136. * src/main.cc (main): Fixed typo.
  2137. * src/message.h: Fixed typo.
  2138. * po/de.po: Added German translation, thanks to Hermann J. Beckers.
  2139. 2006-04-29 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2140. To add --select-file command-line option:
  2141. * src/Util.cc
  2142. (unfoldRange): New function.
  2143. (getNum): New function.
  2144. (unfoldSubRange): New function
  2145. * src/main.cc
  2146. (showUsage): Added help message.
  2147. (main): Added --select-file command-line option. Updated the layout of
  2148. file listing.
  2149. * src/common.h
  2150. (Integers): New definition.
  2151. * src/SocketCore.cc
  2152. (writeData): Removed timeout argument.
  2153. (readData): Removed timeout argument.
  2154. (peekData): Removed timeout argument.
  2155. * src/Socket.cc
  2156. (writeData): Removed timeout argument.
  2157. (readData): Removed timeout argument.
  2158. (peekData): Removed timeout argument.
  2159. * Release 0.4.1
  2160. 2006-04-28 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2161. To deploy upload rate based choking algorithm:
  2162. * src/PeerInteractionCommand.cc
  2163. (PeerInteractionCommand): Add peer to TorrentMan::activePeers to track
  2164. peer currently used.
  2165. (decideChoking): Deleted the choke/unchoke decision algorithm when
  2166. download completes. Simplified.
  2167. (receiveMessage): Updated.
  2168. * src/TorrentMan.h
  2169. (activePeers): New variable.
  2170. (addActivePeer): New function.
  2171. (getActivePeers): New function.
  2172. (deleteActivePeer): New function.
  2173. * src/TorrentMan.cc
  2174. (addPeer): deleteOldErrorPeers is moved to the begining of the function
  2175. * src/PeerAbstractCommand.cc
  2176. (onAbort): Use peer->resetStatus().
  2177. * src/main.cc
  2178. (PeerChokeCommand.h): Included.
  2179. (main): Added the instance of ChokingCommand to the command queue.
  2180. * src/Peer.h
  2181. (amChoking): Renamed from amChocking
  2182. (chokingRequired): New variable.
  2183. (optUnchoking): New variable.
  2184. (deltaUpload): New variable.
  2185. (deltaDownload): New variable.
  2186. (addDeltaUpload): New function.
  2187. (resetDeltaUpload): New function.
  2188. (addDeltaDownload): New function.
  2189. (resetDeltaDownload): New function.
  2190. (addPeerUpload): Added a call to addDeltaUpload.
  2191. (addPeerDownload): Added a call to addDeltaDownload.
  2192. * src/Peer.cc
  2193. (shouldBeChoking): Renamed from shouldChoke.
  2194. (resetStatus): New function.
  2195. * src/PeerChokeCommand.h: New class.
  2196. * src/PeerChokeCommand.cc: New class.
  2197. To add lazy upload speed limiter:
  2198. * src/TorrentConsoleDownloadEngine.h: Moved the variables for
  2199. statistics calculation to TorrentDownloadEngine.
  2200. * src/TorrentConsoleDownloadEngine.cc
  2201. (sendStatistics): Renamed from printStatistics.
  2202. (initStatistics): Removed. Moved to TorrentDownloadEngine.
  2203. (calculateSpeed): Removed. Moved to TorrentDownloadEngine.
  2204. (calculateStatistics): Removed. Moved to TorrentDownloadEngine.
  2205. * src/TorrentDownloadEngine.h: Added the variables for statistics
  2206. calculation.
  2207. (sendStatistics): New function as pure virtual function.
  2208. (getUploadSpeed): New function.
  2209. * src/TorrentDownloadEngine.cc
  2210. (initStatistics): New function.
  2211. (calculateSpeed): New function.
  2212. (calculateStatistics): New function.
  2213. * src/SendMessageQueue.h
  2214. (uploadLength): New variable.
  2215. (send): Added an argument.
  2216. (setUploadLimit): New function.
  2217. (getUploadLimit): New function.
  2218. * src/SendMessageQueue.cc
  2219. (send): Added upload speed limiter.
  2220. * src/prefs.h
  2221. (PREF_UPLOAD_LIMIT): New definition.
  2222. * src/PeerInteractionCommand.cc
  2223. (PeerInteractionCommand): Set upload speed limit to sendMessageQueue.
  2224. * src/main.cc
  2225. (main): Added --upload-limit option
  2226. For bug fixes:
  2227. * src/main.cc
  2228. (showUsage): Corrected --listen-port help
  2229. Other changes:
  2230. * src/TorrentMan.cc
  2231. (getPeer): Return nullPeer if connection is grather than
  2232. MAX_PEER_UPDATE(15) in order to leave space for incoming peers.
  2233. 2006-04-21 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2234. To add some useful information to the exception message:
  2235. * src/SocketCore.cc : Updated messages.
  2236. * src/SegmentMan.cc :
  2237. * src/TorrentMan.cc : Updated messages.
  2238. * src/MultiDiskWriter.cc : Updated messages.
  2239. * src/Util.cc : Updated messages.
  2240. * src/AbstractDiskWriter.cc : Updated messages.
  2241. * src/PreAllocationDiskWriter.cc : Updated messages.
  2242. * src/message.cc : Added new messages. Updated some messages.
  2243. * src/TrackerWatcherCommand.h (MIN_PEERS): New definition.
  2244. * src/TrackerWatcherCommand.cc (execute): Use MIN_PEERS.
  2245. Updated threshold from 30 to 15.
  2246. * src/AbstractDiskWriter.h (filename): New variable.
  2247. * src/AbstractDiskWriter.cc (openExistingFile): Assigned filename.
  2248. (createFile): Assigned filename.
  2249. * src/main.cc: Updated the help message for http-auth-scheme.
  2250. * Release 0.4.0
  2251. 2006-04-20 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2252. To add TrackerUpdateCommand with which replaces
  2253. CompactTrackerResponseProcessor:
  2254. * src/TrackerWatcherCommand.h (req): Removed.
  2255. * src/TrackerWatcherCommand.cc (execute): Send a request to tracker
  2256. if the number of peer connections are less than 30.
  2257. * src/ByteArrayDiskWriter.h (readData): Implemented.
  2258. * src/SegmentMan.h (diskWriter): New function.
  2259. * src/SegmentMan.cc (init): Added a call to diskWriter->closeFile()
  2260. * src/main.cc : Removed #include "CompactTrackerResponseProcessor.h"
  2261. (main): Use TrackerUpdateCommand.
  2262. * src/TorrentMan.h (CompactTrackerResponseProcessor): Removed.
  2263. (req): New variable.
  2264. (setTrackerResponseProcessor): Removed.
  2265. (getTrackerResponseProcessor): Removed.
  2266. (processTrackerResponse): Removed.
  2267. * src/DownloadEngine.h (diskWriter): Removed.
  2268. * src/TorrentDownloadEngine.cc (afterEachIteration): Removed a call
  2269. to torrentMan->processTrackerResponse().
  2270. To add Util::expandBuffer:
  2271. * src/ByteArrayDiskWriter.h (expandBuffer): Removed.
  2272. * src/ByteArrayDiskWriter.cc (writeData): Use Util::expandBuffer().
  2273. * src/Util.h (expandBuffer): New function.
  2274. To fix the bug that causes segmentation fault when "-l ." is specified
  2275. in command-line option:
  2276. * src/SimpleLogger.h (SimpleLogger): Removed "filename" argument.
  2277. (openFile): New function.
  2278. (closeFile): New function.
  2279. * src/SimpleLogger.cc (SimpleLogger): Removed fopen.
  2280. (~SimpleLogger): Call closeFile();
  2281. * src/LogFactory.cc (getInstance): Added a call to slogger->openFile().
  2282. * src/main.cc (main): Added a check to see logger is configured
  2283. properly.
  2284. To enable HTTP authentication without specifying "--http-auth-scheme"
  2285. * src/prefs.h (PREF_HTTP_AUTH_ENABLED): New definition.
  2286. * src/HttpConnection.cc (createRequest): Send Authorization header
  2287. if PREF_HTTP_AUTH_ENABLED == V_TRUE.
  2288. * src/main.cc (main): Preset PREF_HTTP_AUTH_SCHEME to V_TRUE
  2289. If "--http-user" is specified, set PREF_HTTP_AUTH_ENABLED to V_TRUE
  2290. * src/Peer.cc (shouldChoke): Updated algorithm.
  2291. * src/message.h (EX_AUTH_FAILED): New definition.
  2292. (EX_FILE_OPEN): New definition.
  2293. * src/HttpResponseCommand.cc (checkResponse): Throw DlAbortEx
  2294. if status == 401.
  2295. (handleDefaultEncoding): Added a call to diskWriter->initAndOpenFile()
  2296. if req->isTorrent == true.
  2297. * src/main.cc (handler): Removed the check to see e->diskWriter != NULL
  2298. (torrentHandler): Removed the check to see diskAdaptor != NULL.
  2299. * src/AbstractDiskWriter.cc (openExistingFile): Updated messsage.
  2300. (createFile): Updated message.
  2301. 2006-04-19 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2302. To add a readout of estimated remaining time to normal HTTP/FTP
  2303. downloads:
  2304. * src/ConsoleDownloadEngine.h (startup): New variable.
  2305. (startupLength): New variable.
  2306. (isStartupLengthSet): New variable.
  2307. (avgSpeed): New variable.
  2308. (eta): New variable.
  2309. * src/ConsoleDownloadEngine.cc (sendStatistics): Added a readout of
  2310. estimated remaining time.
  2311. (initStatistics): Initialized newly added variables.
  2312. (calculateStatistics): Calculate average speed and estimated remaining
  2313. time.
  2314. To decouple TorrentDownloadEngine from HttpResponseCommand:
  2315. * src/TrackerDownloadCommand.h: Removed.
  2316. * src/TrackerDownloadCommand.cc: Removed.
  2317. * src/TrackerInitCommand.h: Removed.
  2318. * src/TrackerInitCommand.cc: Removed.
  2319. * src/TrackerUpdateCommand.h: Removed.
  2320. * src/TrackerUpdateCommand.cc: Removed.
  2321. * src/TrackerWatcherCommand.cc (execute): The construction of request
  2322. url written in TrackerInitCommand was moved here. Do not create
  2323. tracker request command if torrentMan->trackers != 0.
  2324. * src/CompactTrackerResponseProcessor.h: New class.
  2325. * src/CompactTrackerResponseProcessor.cc: New class.
  2326. * src/message.h (MSG_TRACKER_WARNING_MESSAGE): Updated.
  2327. * src/HttpResponseCommand.cc (createHttpDownloadCommand):
  2328. Decoupled TorrentDownloadEngine from this.
  2329. * src/SegmentMan.h (init): New function.
  2330. * src/SegmentMan.cc (init): New function.
  2331. * src/TorrentMan.h (responseProcessor): New variable.
  2332. (trackers): New variable.
  2333. (setTrackerResponseProcessor): New function.
  2334. (getTrackerResponseProcessor): New function.
  2335. (processTrackerResponse): New function.
  2336. * src/TorrentMan.cc (Constructor): Initialized new variable trackers.
  2337. (processTrackerResponse): New function.
  2338. * src/main.cc (main): Use ByteArrayDiskWriter and
  2339. CompactTrackerResponseProcessor.
  2340. * src/TorrentDownloadEngine.cc (afterEachIteration): Call torrentMan->
  2341. processTrackerResponse().
  2342. * src/TorrentConsoleDownloadEngine.cc (printStatistics): Updated a
  2343. readout.
  2344. * src/TorrentDownloadEngine.cc (afterEachIteration): Added log message
  2345. which indicates download has completed.
  2346. * src/AbstractDiskWriter.cc (Destructor): fd >= 0, not fd >0
  2347. (closeFile): fd >= 0, not fd > 0
  2348. * src/main.cc (main): Added short cut for show-files.
  2349. Added short cut for torrent-file.
  2350. Added new command-line option listen-port.
  2351. Updated i18n messages.
  2352. 2006-04-18 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2353. To add LogFactory which creates singleton logger:
  2354. * src/LogFactory.h: New class.
  2355. * src/LogFactory.cc: New class.
  2356. * src/Command.h (logger): New variable.
  2357. (Constructor): Use LogFactory.
  2358. * src/AbstractCommand.cc: Use Command::logger
  2359. * src/PeerConnection.cc (Constructor): Deleted the argument logger.
  2360. Use LogFactory.
  2361. * src/SegmentSplitter.h : Made logger protected.
  2362. * src/SegmentSplitter.cc (Constructor): Use LogFactory.
  2363. * src/SegmentMan.cc (Constructor): Use LogFactory.
  2364. * src/DownloadEngine.h : Made logger protected.
  2365. * src/DownloadEngine.cc (Constructor): Use LogFactory.
  2366. * src/PeerInteractionCommand.cc : Use Command::logger.
  2367. * src/HttpResponseCommand.cc : Use Command::logger.
  2368. * src/SegmentMan.h : Made logger private.
  2369. * src/TorrentMan.h : Made logger private.
  2370. * src/TorrentMan.cc : Use LogFactory.
  2371. * src/FtpNegotiateCommand.cc : Use Command::logger.
  2372. * src/HttpConnection.h (Constructor): Deleted the argument logger.
  2373. * src/HttpConnection.cc (Constructor): Deleted the argument logger.
  2374. Use LogFactory.
  2375. * src/FtpConnection.h (Constructor): Deleted the argument logger.
  2376. * src/FtpConnection.cc (Constructor): Deleted the argument logger.
  2377. Use LogFactory.
  2378. * src/DownloadCommand.cc : Use Command::logger.
  2379. * src/PeerAbstractCommand.cc : Use Command::logger.
  2380. * src/PeerListenCommand.cc : Use Command::logger.
  2381. * src/PeerInitiateConnectionCommand.cc : Use Command::logger.
  2382. * src/HttpInitiateConnectionCommand.cc : Use Command::logger.
  2383. * src/FtpInitiateConnectionCommand.cc : Use Command::logger.
  2384. * src/TrackerWatcherCommand.cc : Use Command::logger.
  2385. * src/TrackerUpdateCommand.cc : Use Command::logger.
  2386. * src/TrackerDownloadCommand.cc : Use Command::logger.
  2387. * src/RequestSlotMan.cc (Constructor): Deleted the argument logger.
  2388. Use LogFactory.
  2389. * src/SendMessageQueue.h (Constructor): Deleted the argument logger.
  2390. * src/SendMessageQueue.cc (Constructor): Deleted the argument logger.
  2391. Use LogFactory.
  2392. * src/main.cc (main): Use LogFactory.
  2393. * src/DiskAdaptor.h (logger): New variable.
  2394. * src/DiskAdaptor.cc (Constructor): Use LogFactory.
  2395. * src/CopyDiskAdaptor.cc (fixFilename): Added a log message.
  2396. 2006-04-17 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2397. * src/TrackerInitCommand.cc (TrackerInitCommand): Added a "key"
  2398. parameter to a tracker request.
  2399. * src/TorrentMan.cc (readFileEntryFromMetaInfoFile): Bug fix.
  2400. * src/TrackerWatcherCommand.cc (execute): Call req->resetTryCount().
  2401. * src/main.cc (setSignalHander): New function.
  2402. (main): Added a handler for SIGTERM.
  2403. (handler): Updated message.
  2404. (torrentHandler): Updated message.
  2405. 2006-04-16 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2406. * src/TorrentConsoleDownloadEngine.cc
  2407. (onPartialDownloadingCompletes): Renamed as
  2408. onSelectiveDownloadingCompletes.
  2409. (onSelectiveDownloadingCompletes): Updated message.
  2410. To add DiskAdaptor which abstract DiskWriter family:
  2411. * src/PeerConnection.cc: Use diskAdaptor instead of diskWriter.
  2412. * src/PeerInteractionCommand.cc: Use diskAdaptor instead of diskWriter.
  2413. * src/BitfieldMan.cc (isAllBitSet): bug fix.
  2414. * src/TorrentMan.cc : Included CopyDiskAdaptor.h, DirectDiskAdaptor.h,
  2415. MultiDiskAdaptor.h.
  2416. (readFileEntry): Changed its arguments.
  2417. (setup): setupDiskWriter is merged into this function.
  2418. (setupDiskWriter): Removed.
  2419. (setFileFilter): New function.
  2420. (readFileEntryFromMetaInfoFile): Updated according to the changes
  2421. made in readFileEntry.
  2422. (getFilePath): Removed.
  2423. (getTempFilePath): Removed.
  2424. (getSegmentFilePath): Updated due to the removal of getFilePath.
  2425. (fixFilename): Removed.
  2426. (copySingleFile): Removed.
  2427. (splitMultiFile): Removed.
  2428. (deleteTempFile): Removed.
  2429. (setFileEntriesToDownload): Removed.
  2430. (isPartialDownloadingMode): Renamed as isSelectiveDownloadingMode.
  2431. (isSelectiveDownloadingMode): New function.
  2432. (setAllMultiFileRequestedState): Removed.
  2433. (finishPartialDownloadingMode): Renamed as
  2434. finishSelectiveDownloadingMode.
  2435. (finishSelectiveDownloadingMode): New function.
  2436. (getPartialTotalLength): Renamed as getSelectedTotalLength.
  2437. (getSelectedTotalLength): New function.
  2438. (onDownloadComplete): Use diskAdaptor.
  2439. * src/MultiDiskWriter.cc (Constructor): Added the argument pieceLength
  2440. (Range): Removed.
  2441. (setMultiFileEntries): Renamed as setFileEntries.
  2442. (setFileEntries): New function.
  2443. * src/MultiDiskWriter.h [DiskWriterEntry](enabled): Removed.
  2444. (pieceLength): New variable.
  2445. * src/main.cc (printDownloadCompeleteMessage): New function.
  2446. (torrentHandler): Use diskAdaptor instead of diskWriter.
  2447. (main): Renamed torrent-show-files to show-files.
  2448. Rewritten file contents listing.
  2449. * src/TorrentMan.h (FileEntry): Removed.
  2450. (multiFileTopDir): Removed.
  2451. (multiFileEntries): Removed.
  2452. (diskWriter): Removed.
  2453. (diskAdaptor): New variable.
  2454. * src/DefaultDiskWriter.h (totalLength): New variable.
  2455. * src/DefaultDiskWriter.cc (initAndOpenFile): Added ftruncate.
  2456. * src/TorrentDownloadEngine.cc (onEndOfRun): Use diskAdaptor instead of
  2457. diskWriter.
  2458. * src/TorrentConsoleDownloadEngine.h
  2459. (partialDownloadLengthDiff): Renamed as selectedDownloadLengthDiff.
  2460. (partialTotalLength): Renamed as selectedTotalLength.
  2461. * src/AbstractDiskWriter.cc (openFile): If file exists, call
  2462. openExistingFile, otherwise call initAndOpenFile.
  2463. (closeFile): fd > 0, not fd != 0.
  2464. * src/DirectDiskAdaptor.h: New class.
  2465. * src/DirectDiskAdaptor.cc: New class.
  2466. * src/MultiDiskAdaptor.h: New class.
  2467. * src/MultiDiskAdaptor.cc: New class.
  2468. * src/CopyDiskAdaptor.h: New class.
  2469. * src/CopyDiskAdaptor.cc: New class.
  2470. * src/DiskAdaptor.h: New class.
  2471. * src/DiskAdaptor.cc: New class.
  2472. * src/prefs.h (PREF_TORRENT_SHOW_FILES): Renamed as PREF_SHOW_FILES
  2473. (PREF_SHOW_FILES): New definition.
  2474. 2006-04-12 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2475. To add the ability to download multi torrent into respective files
  2476. directly:
  2477. * src/DiskWriter.h (openFile): New function.
  2478. (seek): Removed.
  2479. * src/MultiDiskWriter.h: New class.
  2480. * src/MultiDiskWriter.cc: New class.
  2481. * src/AbstractDiskWriter.h (seek): Changed its scope from public to
  2482. protected.
  2483. (openFile): New function.
  2484. * src/AbstractDiskWriter.cc (openFile): New function.
  2485. * src/prefs.h (V_FALSE): New definition.
  2486. (PREF_DIRECT_FILE_MAPPING): New definition.
  2487. * src/TorrentMan.h (setupDiskWriter): New function.
  2488. (setAllMultiFileRequestedState): New function.
  2489. (onDownloadComplete): New function.
  2490. * src/TorrentMan.cc : Included MultiDiskWriter.h
  2491. (setupDiskWriter): New function.
  2492. (getFilePath): Updated.
  2493. (getTempFilePath): Updated.
  2494. (getSegmentFilePath): Updated.
  2495. (fixFilename): Updated.
  2496. (deleteTempFile): Updated.
  2497. (setAllMultiFileRequestedState): New function.
  2498. (setFileEntriesToDownload): Use setAllMultiFileRequestedState().
  2499. (finishPartialDownloadingMode): Reset requested flags.
  2500. (onDownloadComplete): New function.
  2501. * src/main.cc: Added --direct-file-mapping option.
  2502. Use TorrentMan::setupDiskWriter().
  2503. * src/TorrentDownloadEngine.cc (afterEachIteration): Use TorrentMan::
  2504. onDownloadComplete().
  2505. To fix ETA bug:
  2506. * src/Util.h (difftvsec): New function.
  2507. * src/Util.cc (difftvsec): New function.
  2508. * src/TorrentConsoleDownloadEngine.cc (calculateSpeed): Use int for the
  2509. type of "elapsed" instead of long long int.
  2510. (calculateStatistics): Use Util::difftvsec instead of Util::difftv.
  2511. The updates of statistics takes place every 1 seconds.
  2512. * src/TorrentConsoleDownloadEngine.h (lastElapsed): Changed its type.
  2513. (calculateSpeed): Changed its argument signature.
  2514. * src/PeerMessage.cc (toString): Fixed message.
  2515. 2006-04-06 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2516. To print ETA:
  2517. * src/TorrentDownloadEngine.cc (afterEachIteration): Added download
  2518. completion handling when dealing with
  2519. TorrentMan::isPartialDownloadingMode() == true.
  2520. * src/TorrentDownloadEngine.h (onPartialDownloadingCompletes):
  2521. New function.
  2522. * src/TorrentConsoleDownloadEngine.h (startup): New variable.
  2523. (sessionDownloadLength): New variable.
  2524. (avgSpeed): New variable.
  2525. (eta): New variable.
  2526. * src/TorrentConsoleDownloadEngine.cc (initStatistics): Initialized
  2527. new variables: eta, avgSpeed, startup.
  2528. (calculateSpeed): Calculate average speed and ETA.
  2529. (printStatistics): Added ETA.
  2530. * src/Util.h (secfmt): New function.
  2531. * src/Util.cc (secfmt): New function.
  2532. 2006-04-05 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2533. To detect "keep alive" flooding:
  2534. * src/PeerInteractionCommand.h (keepAliveCount): New variable
  2535. * src/PeerInteractionCommand.cc (Constructor): Initialized new
  2536. variable: keepAliveCount.
  2537. (detectMessageFlooding): Added "keep alive" flooding detection.
  2538. (receiveMessage): Increase keepAliveCount when "keep alive" message
  2539. received.
  2540. To add the ability to download only specified files in multi-file
  2541. torrent:
  2542. * src/BitfieldMan.h (filterBitfield): New variable.
  2543. (filterEnabled): New variable.
  2544. (setFilterBit): New function.
  2545. (enableFilter): New function.
  2546. (disableFilter): New function.
  2547. (isFilterEnabled): New function.
  2548. (getFilteredTotalLength): New function.
  2549. (getCompletedLength): New function.
  2550. * src/BitfieldMan.cc (Constructor): Initialized new variable:
  2551. filterBitfield, filterEnabled.
  2552. (CopyConstructor): Added filterBitfield and filterEnabled.
  2553. (operator==): Added filterBitfield and filterEnabled.
  2554. (Destructor): Added filterBitfield.
  2555. (getMissingIndex): Use filterBitfield.
  2556. (getMissingUnusedIndex): Use filterBitfield.
  2557. (getFirstMissingUnusedIndex): Use filterBitfield.
  2558. (getFirstMissingUnusedIndex): Use filterBitfield.
  2559. (getAllMissingIndexes): Use filterBitfield.
  2560. (countMissingBlock): Use filterBitfield.
  2561. (countBlock): Use filterBitfield.
  2562. (setBitInternal): Added new argument on.
  2563. (setUseBit): Use setBitInternal.
  2564. (unsetUseBit): Use setBitInternal.
  2565. (setBit): Use setBitInternal.
  2566. (unsetBit): Use setBitInternal.
  2567. (isAllBitSet): Use filterBitfield.
  2568. (setFilterBit): New function.
  2569. (addFilter): New function.
  2570. (enableFilter): New function.
  2571. (disableFilter): New function.
  2572. (clearFilter): New function.
  2573. (isFilterEnabled): New function.
  2574. (getFilteredTotalLength): New function.
  2575. (getCompletedLength): New function.
  2576. * src/TorrentMan.h [FileEntry](Constructor): Updated signature.
  2577. Initalized newly added variables.
  2578. [FileEntry](offset): New variable.
  2579. [FileEntry](extracted): New variable.
  2580. [FileEntry](requested): New variable.
  2581. (readFileEntry): New function.
  2582. (option): New variable.
  2583. (splitMultiFile): Removed const qualifier.
  2584. (fixFilename): Removed const qualifier.
  2585. (readFileEntryFromMetaInfoFile): New function.
  2586. (finishPartialDownloadingMode): New function.
  2587. (isPartialDownloadingMode): New function.
  2588. (setFileEntriesToDownload): New function.
  2589. (getCompletedLength): New function.
  2590. (getPartialTotalLength): New function.
  2591. * src/TorrentMan.cc (readFileEntry): New function.
  2592. (setup): Use readFileEntry. If no-preallocation option is specified,
  2593. use DefaultDiskWriter.
  2594. (readFileEntryFromMetaInfoFile): New function.
  2595. (fixFilename): Removed const qualifier.
  2596. (splitMultiFile): Removed const qualifier.
  2597. (setFileEntriesToDownload): New function.
  2598. (isPartialDownloadingMode): New function.
  2599. (finishPartialDownloadingMode): New function.
  2600. (getCompletedLength): New function.
  2601. (getPartialTotalLength): New function.
  2602. * src/TorrentConsoleDownloadEngine.h (partialDownloadLengthDiff):
  2603. New variable.
  2604. (partialTotalLength): New variable.
  2605. (downloadLength): New variable.
  2606. (totalLength): New variable.
  2607. * src/TorrentConsoleDownloadEngine.cc (onPartialDownloadingCompletes):
  2608. Added log.
  2609. (initStatistics): Initialized new variables: partialDownloadLengthDiff,
  2610. partialTotalLength, downloadLength, totalLength.
  2611. (calculate): Calculate downloadLength and totalLength.
  2612. * src/prefs.h :New definition PREF_NO_PREALLOCATION
  2613. * src/main.cc (addCommand): Changed argument signature.
  2614. (main): Added new variable: args. Added new option "torrent-show-files"
  2615. "no-preallocation". Usage is not updated yet.
  2616. 2006-04-02 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2617. * src/PeerMessage.cc (setBitfield): Fixed invalid memory de-allocation.
  2618. 2006-04-01 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2619. Attempt to add the ability to listing file entries in a .torrent file.
  2620. This feature is not yet complete.
  2621. * src/prefs.h (PREF_TORRENT_SHOW_FILES): New definition
  2622. * src/TorrentMan.cc (getMultiFileEntries): New function.
  2623. (getName): New function.
  2624. * src/TorrentMan.h (getMultiFileEntries): New function.
  2625. (getName): New function.
  2626. * src/main.cc (main): Use above 2 funtion.
  2627. * Release 0.3.2
  2628. 2006-03-31 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2629. * src/PeerInteractionCommand.cc (checkInactiveConnection): New function
  2630. (detectMessageFlooding): Updated threshold value.
  2631. (checkLongTimePeerChoking): Updated timeout value.
  2632. (getNewPieceAndSendInterest): Added debug log.
  2633. * src/PeerInteractionCommand.h (checkInactiveConnection): New function
  2634. * src/TorrentMan.cc (deleteOldErrorPeers): Updated.
  2635. (getPeer): Updated.
  2636. * src/TorrentMan.h: Added MAX_PEER_ERROR.
  2637. * src/PeerAbstractCommand.cc (onAbort): Increment error counter.
  2638. * src/PeerListenCommand.cc (execute): Close connection if incoming peer
  2639. is localhost.
  2640. * src/main.cc (main): Updated PREF_PEER_CONNECTION_TIMEOUT to 60.
  2641. * src/PendingMessage.cc (processMessage): Not to send piece message
  2642. if peer is not interested in the pieces localhost has.
  2643. * src/Peer.cc (shouldChoke): Updated.
  2644. * src/SendMessageQueue.cc (cancelAllRequest): Fixed.
  2645. * src/Util.cc (isPowerOf): New function.
  2646. * src/Util.h (isPowerOf): New function.
  2647. * src/PeerMessageUtil.cc (checkLength): Added a check for length
  2648. whether or not it is power of 2.
  2649. 2006-03-28 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2650. Added new class SendMessageQueue that includes PendingMessages and
  2651. RequestSlotMan.
  2652. * src/SendMessageQueue.h: New class.
  2653. * src/SendMessageQueue.cc: New class.
  2654. * src/PendingMessage.h: Added new member variable blockIndex and its
  2655. accessors.
  2656. (createRequestMessage): Updated.
  2657. * src/PendingMessage.cc (createRequestMessage): Updated.
  2658. * src/PeerInteractionCommand.cc (executeInternal): Updated with
  2659. SendMessageQueue.
  2660. (checkLongTimePeerChoking): Updated with SendMessageQueue.
  2661. (receiveMessage): Updated with SendMessageQueue.
  2662. (deletePendingPieceMessage): Removed.
  2663. (getNewPieceAndSendInterest): Updated with SendMessageQueue.
  2664. (sendInterest): Updated with SendMessageQueue.
  2665. (createRequestPendingMessage): Updated with SendMessageQueue.
  2666. (sendMessages): Updated with SendMessageQueue.
  2667. (onAbort): Updated with SendMessageQueue.
  2668. (keepAlive): Updated with SendMessageQueue.
  2669. (beforeSocketCheck): Updated SendMessageQueue.
  2670. * src/PeerInteractionCommand (sendMessages): Shuffle
  2671. missingBLockIndexes before using it.
  2672. Added its own timeout for peer connection.
  2673. * src/PeerAbstractCommand.h: Added member variable timeout and its
  2674. setter.
  2675. * src/prefs.h: Added PREF_PEER_CONNECTION_TIMEOUT.
  2676. * src/PeerInteractionCommand.cc (PeerInteractionCommand):
  2677. Added setTimeout() call.
  2678. (executeInternal): Added setTimeout() call.
  2679. * src/PeerAbstractCommand.cc (PeerAbstractCommand):
  2680. Added timeout.
  2681. (isTimeoutDetected): Updated.
  2682. * src/main.cc (main): Added PREF_PEER_CONNECTION_TIMEOUT entry to
  2683. option.
  2684. Added *simple* message flooding checker.
  2685. * src/PeerInteractionCommand.cc (executeInternal):
  2686. Added detectMessageFlooding() call.
  2687. (detectMessageFlooding): New function.
  2688. (receiveMessage): Count up CHOKE, UNCHOKE, HAVE message.
  2689. (beforeSocketCheck): Added detectMessageFlooding() call.
  2690. * src/PeerInteractionCommand.h: Added sendMessageQueue,
  2691. chokeUnchokeCount, haveCount, detectMessageFlooding().
  2692. Removed deletePendingPieceMessage(), getRequestSlot(),
  2693. deleteRequestSlot(), deleteAllRequestSlot().
  2694. * src/PeerInteractionCommand.cc (beforeSocketCheck):
  2695. Added checkLongTimePeerChoking() call.
  2696. * src/RequestSlotMan.h: Renamed deleteTimeoutRequestSlot().
  2697. * src/TorrentMan.cc (addPeer): Delete at most MAX_PEER_LIST_SIZE peers
  2698. if duplicate == false.
  2699. The parameter "uploaded" and "downloaded" in the tracker request are
  2700. the size since the client sent the "started" event to the tracker.
  2701. * src/TorrentMan.cc (setup): Assigned saved downloaded Size and
  2702. uploaded size to preDownloadedSize, preUploadedSize respectively.
  2703. * src/TorrentMan.h: Added preDownloadedSize, preUploadedSize,
  2704. getSessionDownloadedSize(), getSessionUploadedSize().
  2705. * src/TrackerInitCommand.cc (execute): Use getSessionDownloadedSize(),
  2706. getSessionUploadedSize() instead of getDownloadedSize(),
  2707. getUploadedSize().
  2708. * src/PendingMessage.cc (processMessage): Do not send request message
  2709. if the peer is choking the client.
  2710. * src/TrackerUpdateCommand.cc (execute): Check wtheher minInterval is
  2711. less than interval.
  2712. 2006-03-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2713. * configure.in: Added gnutls support. Added several CPP macros.
  2714. * m4/openssl.m4: Added.
  2715. * src/SocketCore.{h,cc}: Drop const quarifier from writeData(),
  2716. readData(), peekData(). Added gnutls support.
  2717. * src/HttpDownloadCommand.cc: Removed SleepCommand.h
  2718. * src/TrackerWatcherCommand.{h,cc}: Added. This command creates
  2719. TrackerInitCommand periodicaly(TorrentMan::minInterval).
  2720. * src/TorrentMan.cc: Remove downloadedSize == 0 check from save().
  2721. Instead, added a check for whether setup method has executed
  2722. successfully.
  2723. * src/TorrentMan.h: Added member vaiable setupComplete. Updated
  2724. DEFAULT_ANNOUNCE_INTERVAL and DEFAULT_ANNOUNCE_MIN_INTERVAL to 300.
  2725. * src/Makefile.am: Updated.
  2726. * src/messageDigest.h: Added. This is a macro calculating SHA1 digest
  2727. using whether OpenSSL or gcrypt, depending on the result of configure
  2728. script.
  2729. * src/ShaVisitor.{h,cc}: Removed direct dependency on OpenSSL by using
  2730. messageDigest.h.
  2731. * src/TorrentAutoSaveCommand.h: Removed unused variable cuid.
  2732. * src/PeerListenCommand.cc: Added log about port binded successfully.
  2733. Fixed memory leak.
  2734. * src/main.cc: Added gnutls support. Replaced LIB_SSL with
  2735. ENABLE_BITTORRENT where they are not related to OpenSSL but BitTorrent.
  2736. Removed instantiation of TrackerInitCommand. Instead,
  2737. TrackerWatcherCommand is instantiated and pushed to the command queue.
  2738. * src/InitiateConnectionCommandFactory.cc: Replaced HAVE_LIBSSL with
  2739. ENABLE_SSL.
  2740. * src/Request.cc: Replaced HAVE_LIBSSL with ENABLE_SSL.
  2741. * src/RequestSlotMan.cc (deleteCompletedRequestSlot):
  2742. If a piece is already acquired by another command, delete the request
  2743. slots for the piece.
  2744. * src/TrackerUpdateCommand.cc (execute):
  2745. Changed log level of MSG_TRACKER_WARNING_MESSAGE from info to warn.
  2746. Added a check whether peer list is null.
  2747. Fixed the bug that causes sending completed event to the tracker
  2748. several times.
  2749. * src/TrackerInitCommand.cc (execute):
  2750. Fixed the bug that causes sending completed event to the tracker
  2751. several times.
  2752. * src/AbstractDiskWriter.{h,cc}: Removed direct dependency on OpenSSL
  2753. by using messageDigest.h.
  2754. 2006-03-26 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2755. * PeerConnection.cc: Replaced log message "keep-alive" with
  2756. "keep alive".
  2757. * PeerInteractionCommand.{h,cc}: Close connection if peer is choking
  2758. localhost long time.
  2759. * TorrentMan.cc: When adding new peer with duplicate = true, if the
  2760. number of peer list is equal to or grater than MAX_PEER_LIST, delete
  2761. at most 100 failure entry from the list. If with duplicate = false,
  2762. MAX_PEER_LIST is not checked.
  2763. * PeerListenCommand.cc: Fixed the argument order of log message.
  2764. 2006-03-25 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2765. * Logger.h: Moved enum LEVEL from SimpleLogger.h to here.
  2766. Added warn().
  2767. * SimpleLogger.h: Moved enum LEVEL to Logger.h.
  2768. Implemented warn().
  2769. Defined 2 macros(WRITE_LOG, WRITE_LOG_EX) to avoid duplicated code.
  2770. 2006-03-24 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2771. * Request.h: Added AFTER_COMPLETED event.
  2772. * TorrentDownloadEngine.cc: Prints "Download complete" message
  2773. instead of downloaded size and progress(%) after download completes.
  2774. * PeerInteractionCommand.cc: After download completes, sends unchoke
  2775. message to the peer if it is interested in what localhost has
  2776. downloaded.
  2777. * TorrentMan.cc: In single-file mode, copy temporary file to the final
  2778. destination instead of just renaming it.
  2779. * TorrentMan.cc: Added deleteTempFile().
  2780. * PeerAbstractCommand.cc: do not stop execution after download
  2781. completes. This makes localhost a seeder.
  2782. * Util.{h,cc}: Added fileCopy().
  2783. * PeerListenCommand.cc: do not stop execution after download completes.
  2784. This makes localhost a seeder.
  2785. * main.cc: Do not call TorrentMan::fixFilename() in torrentHandler.
  2786. Added TorrentMan::deleteTempFile() to torrentHandler.
  2787. Initialized the variable dir as ".".
  2788. * TorrentMan.h: Changed DEFAULT_ANNOUNCE_INTERVAL to 120 seconds.
  2789. Deleted renameSingleFile().
  2790. Added copySingleFile(), deleteTempFile().
  2791. * DownloadEngine.h: Added virtual function afterEachIteration().
  2792. * TorrentDownloadEngine.cc: Move a call to TorrentMan::fixFilename()
  2793. in onEndOfRun() to afterEachIteration().
  2794. In onEndOfRun(), changed if condition to check whether filenameFixed is
  2795. true.
  2796. * Util.cc: Implemented fileCopy() using rangedFileCopy().
  2797. In rangedFileCopy(), added try-catch block to properly close file
  2798. descriptors.
  2799. * TorrentDownloadEngine.cc: Added a member variable filenameFixed.
  2800. Added afterEachIteration(), isFilenameFixed().
  2801. * Peer.cc: Changed choking strategy.
  2802. * PreAllocationDiskWriter.cc: Drop O_DIRECT flag.
  2803. * TrackerInitCommand.cc: Send completed event only once.
  2804. * DownloadEngine.cc: Added a call to afterEachIteration().
  2805. * TrackerUpdateCommand.cc: Do not stop execution after download
  2806. completes.
  2807. * TorrentMan.h: Defined MAX_PEER_UPDATE as 15. aria2 attempts to
  2808. connect the peers at most MAX_PEER_UPDATE when a peer list is
  2809. received from a tracker.
  2810. * TrackerUpdateCommand.cc: Implemented above mentioned behavior.
  2811. Decreased the number of failure peers to delete to 0(just comment out
  2812. the line).
  2813. * Release 0.3.1
  2814. 2006-03-23 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2815. * PeerInteractionCommand.cc: added a call to
  2816. TorrentMan::unadvertisePiece in Destructor.
  2817. * PeerInteractionCommand.cc: make have message sent immediately
  2818. if the size of pending message queue is zero.
  2819. * TorrentMan.cc: set the maximum size of peer list to 250.
  2820. * TorrentMan.h: changed the container type of Peers and UsedPieces
  2821. to deque.
  2822. * Util.cc: fixed rangedFileCopy.
  2823. * AbstractDiskWriter.{h,cc}: moved digest context initialization
  2824. to Constructor. Also, moved digest cleanup to Destructor.
  2825. * MetaFileUtil.cc: fixed memory leak
  2826. * replaced std::vector with std::deque.
  2827. * AbstractCommand.cc: casted timeout value to long long int.
  2828. * ChunkedEncoding.cc: fixed memory leak.
  2829. * PeerInteractionCommand.cc: casted timeout value to long long int.
  2830. * SleepCommand.cc: casted timeout value to long long int.
  2831. * Data.cc: fixed memory leak.
  2832. * Data.cc: fixed toLLInt().
  2833. * BitfieldMan.cc: fixed memory leak.
  2834. * TorrentMan.cc: initialized storeDir to ".".
  2835. * TorrentMan.cc: fixed memory leak.
  2836. * TorrentMan.cc: corrected file paths of splitted files.
  2837. * PeerAbstractCommand.cc: casted timeout to long long int.
  2838. * main.cc: added delete(req) and delete(te->diskWriter).
  2839. * RequestSlot.cc: casted timeout value to long long int.
  2840. * Request.cc: fixed memory leak.
  2841. * PendingMessage.cc: make HAVE messages sent only when peer does not
  2842. have the piece.
  2843. * Peer.{h,cc}: added hasPiece(int index).
  2844. * main.cc: corrected addCommand.
  2845. 2006-03-22 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2846. * BitTorrent protocol support added.
  2847. * Release 0.3.0
  2848. 2006-03-17 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2849. * SocketCore.cc: remove the assignment of addrinfo.ai_addr.
  2850. 2006-03-09 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2851. * ChunkedEncoding.{h,cc}: fixed the bug that if chunk data is binary,
  2852. decoding did not work properly.
  2853. 2006-03-07 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2854. * DownloadEngine.h: included sys/time.h
  2855. * DownloadEngine.cc: remove sys/time.h
  2856. * Makefile.am (SUBDIRS): Add intl.
  2857. * configure.in (AC_CONFIG_FILES): Add intl/Makefile.
  2858. 2006-03-05 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2859. * main.cc: correct help message for --http-auth-scheme.
  2860. * main.cc: changed e-mail address for bug reports.
  2861. * ja.po: added japanese translation.
  2862. 2006-03-04 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2863. * SimpleLogger.cc: flush log file instead of stdout.
  2864. 2006-03-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2865. * main.cc: Fixed command-line option: max-tries
  2866. * HttpResponseCommand.cc: Make the request re-sent only if req->seg.sp
  2867. does not equal to seg.sp.
  2868. * DownloadCommand.cc: If EOF is got from the server and the total size
  2869. of file is not zero, then throw DlRetryEx.
  2870. * main.cc: Set the minium value of min-segment-size to 1024.
  2871. * HttpResponseCommand.cc: Fixed the bug that http segmented downloading
  2872. fails because of a regression since 0.2.0 release.
  2873. 2006-03-02 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2874. * HttpConnection.cc:
  2875. * common.h: defined the user agent name as macro
  2876. * DownloadEngine.{h, cc}:
  2877. * ConsoleDownloadEngine.{h, cc}: Console output message(size, speed)
  2878. is now generated by ConsoleDownloadEngine not by DownloadEngine.
  2879. * main.cc: Download complete/abort message is now generated by main.
  2880. * Makefile.am (SUBDIRS): Add m4.
  2881. (ACLOCAL_AMFLAGS): New variable.
  2882. (EXTRA_DIST): New variable.
  2883. * configure.in (AC_CONFIG_FILES): Add po/Makefile.in,
  2884. * gettext: added gettext functionality
  2885. 2006-03-01 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2886. * AbstractCommand.cc:
  2887. * DownloadCommand.{h, cc}: Aborted downloading commands now properly
  2888. unregister its cuid from SegmentMan.
  2889. * DownloadEngine.cc: .aria2 file was written when a downloading
  2890. failed with errors.
  2891. * HttpConnection.cc: Added "Proxy-Connection" header to proxy request.
  2892. Added "User-Agent" header to CONNECT proxy request.
  2893. Fixed "Proxy-Authorization" header. Now proxy authorization works
  2894. properly.
  2895. * Logger.h:
  2896. * SimpleLogger.{h,cc}: Changed the type of msg to const char*.
  2897. * ChunkedEncoding.cc: Added #include directive for strings.h
  2898. * Release 0.2.1
  2899. 2006-02-28 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2900. * Util.{h,cc}: added startsWith().
  2901. * CookieBox.cc: rewrited criteriaFind() using Util::startsWith() and
  2902. Util::endsWith().
  2903. * SocketCore.cc: struct addrinfo is now zero-initialized.
  2904. * common.h: added #include directive of limit.h.
  2905. * DownloadEngine.cc: added #include directive of sys/time.h and
  2906. algorithm.
  2907. * Exception.h: added #include directive of stdio.h.
  2908. * AbstractCommand.h: added #include directive of sys/time.h.
  2909. * DownloadCommand.h: added #include directive of sys/time.h.
  2910. * *.h: added #include directive of common.h to all base classes.
  2911. subclasses' one was removed.
  2912. * common.h: defined LONG_LONG_MAX and LONG_LONG_MIN if a compiler
  2913. does not define these macros.
  2914. 2006-02-23 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2915. * Release 0.2.0
  2916. * main.cc:
  2917. * HttpInitiateConnectionCommand.{h,cc}:
  2918. * prefs.h:
  2919. * HttpConnection.{h,cc}: added --http-proxy-method option.
  2920. We can now use GET command in http proxy.
  2921. 2006-02-22 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2922. * SplitSlowestSegmentSplitter.{h,cc}: This class provies algorithm
  2923. that splits slowest segment of SegmentMan::commands vector.
  2924. This is the default split algorithm of aria2.
  2925. * SplitFirstSegmentSplitter.{h,cc}: This class provides algorithm
  2926. that splits first segment of SegmentMan::commands vector.
  2927. * SegmentSplitter.{h,cc}: Added. This class provides split algorithm.
  2928. * DownloadCommand.{h,cc}: Added downloading speed calculation.
  2929. * Segment.h:
  2930. * SegmentMan.cc: Added speed field to Segment.h
  2931. * main.cc: -s option now affects all URLs in command-line arguemtns.
  2932. * HttpResponseCommand.cc: Fixed bug that segment file is not loaded.
  2933. * message.h: Change file size related %d to %lld.
  2934. 2006-02-21 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2935. * FtpInitiateConnectionCommand.{h,cc}:
  2936. * FtpNegotiationCommand.{h,cc}:
  2937. * FtpDownloadCommand.{h,cc}:
  2938. * FtpConnection.{h,cc}: Added FTP support
  2939. * SimpleLogger.cc: Log message now includes time information.
  2940. * main.cc: The value of --http-auth-scheme option is chagned from
  2941. 'BASIC' to 'basic'
  2942. * main.cc: Added --timeout command-line option.
  2943. * main.cc: Added --min-segment-size command-line option.
  2944. * main.cc: Added --max-retries command-line option.
  2945. * prefs.h: option string constants are now defined in prefs.h
  2946. 2006-02-19 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2947. * AbstractCommand.cc: Fixed timeout bug in AbstractCommand
  2948. * SegmentMan.cc: Added totalSize entry to .aria2 file. No compatibility
  2949. with version 0.1.0's one.
  2950. 2006-02-18 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2951. * configure.in: Added --enable-ssl option to configure script.
  2952. * HttpConnection.cc: Make Request-URI an absolute path. Some servers
  2953. cannot permit absoluteURI as Request-URI.
  2954. * HttpConnection.cc: Added Referer support.
  2955. * main.cc: Added referer command-line option.
  2956. * main.cc: Added rety-wait command-line option.
  2957. * Exception.h: Fixed formating bug in Exception::setMsg()
  2958. * SocketCore.{h,cc}:
  2959. * Socket.{h, cc}:
  2960. * Request.cc:
  2961. * InitiateConnectionCommandFactory.cc:
  2962. * HttpRequestCommand.cc: Added HTTPS support.
  2963. * SocketCore.{h,cc}: Added SocketCore. Socket becomes a handle class
  2964. for SocketCore.
  2965. * ChunkedEncoding.cc: Fixed bug in ChunkedEncoding: expanding buffer
  2966. size is wrong
  2967. * DownloadCommand.cc: Fixed bug in DownloadCommand: In Chunked
  2968. Encoding, it wrongly adds to Segment.ds buff length from the socket.
  2969. 2006-02-17 Tatsuhiro Tsujikawa <tsujikawa at rednoah dot com>
  2970. * Release 0.1.0