ChangeLog 163 KB

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