ChangeLog 225 KB

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