ChangeLog 212 KB

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