ChangeLog 193 KB

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