ChangeLog 233 KB

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