ChangeLog 172 KB

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