ChangeLog 199 KB

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