ChangeLog 202 KB

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