ChangeLog 167 KB

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