ChangeLog 221 KB

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