ChangeLog 217 KB

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