ChangeLog 252 KB

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