ChangeLog 133 KB

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