ChangeLog 234 KB

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