ChangeLog 232 KB

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