ChangeLog 218 KB

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