ChangeLog 163 KB

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