ChangeLog 211 KB

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