ChangeLog 162 KB

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