ChangeLog 161 KB

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