ChangeLog 118 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382
  1. 2006-08-11 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2. To add asynchronous DNS support(libares):
  3. * src/AbstractCommand.h
  4. (setNameResolverCheck): New function.
  5. (disableNameResolverCheck): New function
  6. (resolveHostname): New function.
  7. * src/AbstractCommand.cc
  8. (setNameResolverCheck): New function.
  9. (disableNameResolverCheck): New function
  10. (resolveHostname): New function.
  11. * src/FtpInitiateConnectionCommand.h
  12. (nameResolver): New function.
  13. * src/FtpInitiateConnectionCommand.cc
  14. (Util.h): Included.
  15. (FtpInitiateConnectionCommand): Call disableReadCheckSocket,
  16. disableWriteCheckSocket.
  17. (~FtpInitiateConnectionCommand): Call disableNameResolverCheck.
  18. (executeInternal): Added async DNS support.
  19. * src/HttpInitiateConnectionCommand.h
  20. (nameResolver): New function.
  21. * src/HttpInitiateConnectionCommand.cc
  22. (DlRetryEx.h): Included.
  23. (HttpInitiateConnectionCommand): Call disableReadCheckSocket,
  24. disableWriteCheckSocket.
  25. (~HttpInitiateConnectionCommand): Call disableNameResolverCheck.
  26. (executeInternal): Added async DNS support.
  27. * src/NameResolver.h: New class. Note: #include <ares.h> is surrounded
  28. by extern "C" declaration.
  29. * src/NameResolver.cc: New class.
  30. * src/Util.h:
  31. (isNumberAndDotsNotation): New function
  32. * src/Util.cc
  33. (isNumberAndDotsNotation): New function.
  34. * src/DownloadEngine.h
  35. (NameResolver.h): Included.
  36. (NameResolverEntry): New class.
  37. (NameResolverEntries): New type definition.
  38. (addNameResolverCheck): New function.
  39. (deleteNameResolverCheck): New function.
  40. * src/DownloadEngine.cc
  41. (run): Initialize cp with 0.
  42. (SetDescriptor::operator()): Added for NameResolverEntry.
  43. (AccumulateActiveUuid::operator()): Added for NameResolverEntry.
  44. (waitData): Check nameResolver entries.
  45. (updateFdSet): Update fds in nameResolver entries.
  46. (addNameResolverCheck): New function.
  47. (deleteNameResolverCheck): new function.
  48. * src/PeerInteractionCommand.cc
  49. (executeInternal): Fixed wrong socket handling.
  50. * src/main.cc
  51. (main): Fixed the initial value of PREF_LOWEST_SPEED_LIMIT option to 0.
  52. * src/Util.cc
  53. (fileChecksum): Removed the call to ctx.digestReset().
  54. 2006-08-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  55. * po/ru.po: Azamat sent me Russian translation.
  56. * src/FtpNegotiateCommand.cc
  57. (recvGreeting): Call disableWriteCheckSocket just after
  58. socket->setBlockingMode(). This avoids unnecessary CPU-hog loop.
  59. (recvRetr): Recognized status code 125 as a acceptable response code.
  60. Rename Time.h to TimeA2.h to avoid compilation ploblem on
  61. case-insesitive filesystem(BUG#1531057).
  62. * src/Time.h: Renamed as TimeA2.h.
  63. * src/Time.cc: Renamed as TimeA2.cc.
  64. * src/TimeA2.h: New class.
  65. * src/TimeA2.cc: New class.
  66. * src/PeerChokeCommand.h: Replaced Time.h with TimeA2.h.
  67. * src/TrackerWatcherCommand.h: Replaced Time.h with TimeA2.h.
  68. * src/PeerAbstractCommand.h: Replaced Time.h with TimeA2.h.
  69. * src/AbstractCommand.h: Replaced Time.h with TimeA2.h.
  70. * src/PeerInteractionCommand.h: Replaced Time.h with TimeA2.h.
  71. * src/ConsoleDownloadEngine.h: Replaced Time.h with TimeA2.h.
  72. * src/TorrentAutoSaveCommand.h: Replaced Time.h with TimeA2.h.
  73. * src/DownloadCommand.h: Replaced Time.h with TimeA2.h.
  74. * src/TorrentMan.h: Replaced Time.h with TimeA2.h.
  75. * src/TorrentDownloadEngine.h: Replaced Time.h with TimeA2.h.
  76. * src/RequestSlot.h: Replaced Time.h with TimeA2.h.
  77. * src/SleepCommand.h: Replaced Time.h with TimeA2.h.
  78. * src/DownloadEngine.cc: Replaced Time.h with TimeA2.h.
  79. 2006-08-07 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  80. * src/PeerChokeCommand.h
  81. (PeerChokeCommand): Rearranged the arguments.
  82. * src/PeerChokeCommand.cc
  83. (PeerChokeCommand): Rearranged the arguments.
  84. * src/MetalinkEntry.h
  85. (Checksum.h): Included.
  86. (md5): Removed.
  87. (sha1): Removed.
  88. (checksum): New variable.
  89. (operator=): Updated.
  90. (check): Removed.
  91. * src/prefs.h
  92. (PREF_LOWEST_SPEED_LIMIT): New definition.
  93. (PREF_FOLLOW_TORRENT): New definition.
  94. (PREF_SELECT_FILE): New definition.
  95. (PREF_FOLLOW_METALINK): New definition.
  96. * src/MetalinkResource.h
  97. (TYPE_HTTPS): Added to enum TYPE.
  98. * src/TorrentMan.cc
  99. (~TorrentMan): Rewritten.
  100. * src/MultiDiskWriter.cc
  101. (MultiDiskAdaptor): Updated according to the changes in
  102. MessageDigestContext.
  103. (~MultiDiskAdaptor): Updated according to the changes in
  104. MessageDigestContext.
  105. (hashUpdate): Updated according to the changes in MessageDigestContext.
  106. (sha1Sum): Updated according to the changes in MessageDigestContext.
  107. * src/Util.h
  108. (fileChecksum): Updated according to the changes in
  109. MessageDigestContext.
  110. * src/Util.cc
  111. (sha1Sum): Updated according to the changes in MessageDigestContext.
  112. (fileChecksum): Updated according to the changes in
  113. MessageDigestContext.
  114. * src/messageDigest.h: Rewritten.
  115. * src/MetalinkEntry.cc
  116. (check): Removed.
  117. (Supported): Updated.
  118. (dropUnsupportedResource): Fixed a memory leak.
  119. * src/ShaVisitor.cc
  120. (ShaVisitor): Updated according to the changes in MessageDigestContext.
  121. (~ShaVisitor): Updated according to the changes in
  122. MessageDigestContext.
  123. (visit): Updated according to the changes in MessageDigestContext.
  124. * src/main.cc
  125. (main): Rewritten the portion of download loop. --lowest-speed-limit
  126. command-line option added.
  127. * src/DownloadEngine.h
  128. (SocketEntry): New class.
  129. (SocketEntries): New definition.
  130. (PairFind): Removed.
  131. (SockCmdMap): Removed.
  132. * src/DownloadEngine.cc
  133. (DownloadEngine): Rewritten.
  134. (~DownloadEngine): Rewritten.
  135. (run): Renamed activeCommandUuids as activeUuids.
  136. (SetDescriptor): Rewritten.
  137. (AccumulateActiveCommandUuid): Removed.
  138. (AccumulateActiveUuid): New function object.
  139. (waitData): Rewritten.
  140. (updateFdSet): Rewritten.
  141. (addSocket): Rewritten.
  142. (deleteSocket): Rewritten.
  143. (addSocketForReadCheck): Rewritten.
  144. (deleteSocketForReadCheck): Rewritten.
  145. (addSocketForWriteCheck): Rewritten.
  146. (deleteSocketForWriteCheck): Rewritten.
  147. * src/Xml2MetalinkProcessor.cc
  148. (getEntry): Rewritten the portion of MetalinkEntry creation.
  149. * src/DownloadCommand.cc
  150. (executeInternal): Added the check routine for lowest speed limit.
  151. * src/AbstractDiskWriter.cc
  152. (AbstractDiskWriter): Updated according to the changes in
  153. MessageDigestContext.
  154. (~AbstractDiskWriter): Updated according to the changes in
  155. MessageDigestContext.
  156. (sha1Sum): Updated according to the changes in MessageDigestContext.
  157. * src/RequestInfo.h: New class.
  158. * src/UrlRequestInfo.h: New class.
  159. * src/UrlRequestInfo.cc: New class.
  160. * src/TorrentRequestInfo.h: New class.
  161. * src/TorrentRequestInfo.cc: New class.
  162. * src/MetalinkRequestInfo.h: New class.
  163. * src/MetalinkRequestInfo.cc: New class.
  164. * src/Checksum.h: New class.
  165. * src/DownloadEngineFactory.h: New class.
  166. * src/DownloadEngineFactory.cc: New class.
  167. 2006-08-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  168. * src/Option.h
  169. (getAsBool): New function.
  170. * src/Option.cc
  171. (prefs.h): Included.
  172. (defined): 0-length value is now recognized as undefined.
  173. (getAsInt): Rewritten.
  174. (getAsLLInt): Rewritten.
  175. (getAsBool): New function.
  176. * src/FeatureConfig.h: Rewritten.
  177. * src/FeatureConfig.cc: Rewritten.
  178. * src/prefs.h
  179. (PREF_STDOUT_LOG): New definition.
  180. (PREF_LOG): New definition.
  181. (PREF_DIR): New definition.
  182. (PREF_OUT): New definition.
  183. (PREF_SPLIT): New definition.
  184. (PREF_DAEMON): New definition.
  185. (PREF_REFERER): New definition.
  186. (PREF_TORRENT_FILE): New definition.
  187. (PREF_LISTEN_PORT): New definition.
  188. (PREF_METALINK_FILE): New definition.
  189. (PREF_METALINK_VERSION): New definition.
  190. (PREF_METALINK_LANGUAGE): New definition.
  191. (PREF_METALINK_OS): New definition.
  192. (PREF_METALINK_SERVERS): New definition.
  193. * src/main.cc
  194. (main): Following command-line parameters are now put into Option
  195. class: stdoutLog, logfile, dir, ufilename, split, daemonMode,
  196. referer, torrentFile, metalinkFile, listenPort, metalinkVersion,
  197. metalinkLanguage, metalinkOs, metalinkServers
  198. To fix the bug that aria2 can not handle http response header properly.
  199. * src/HttpHeader.cc
  200. (put): Made name lowercased.
  201. (defined): Made name lowercased.
  202. (getFirst): Made name lowercased.
  203. (get): Made name lowercased.
  204. (getFirstAsInt): Rewritten.
  205. (getFirstAsLLInt): Rewritten.
  206. 2006-07-30 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  207. * src/TorrentMan.h:
  208. (advertisePiece): Updated doc.
  209. (getAdvertisedPieceIndexes): Updated doc.
  210. (removeAdvertisedPiece); New function.
  211. * src/TorrentMan.cc
  212. (FindElapsedHave): New function object.
  213. (removeAdvertisedPiece): New function.
  214. * src/HaveEraseCommand.h: New class.
  215. * src/HaveEraseCommand.cc: New class.
  216. * src/FeatureConfig.h: New class.
  217. * src/FeatureConfig.cc: New class.
  218. * src/Request.h
  219. (defaultPorts): Removed.
  220. * src/Request.cc
  221. (FeatureConfig.h): Included.
  222. (Request): Removed the statements related to defaultPorts.
  223. (parseUrl): Removed metalinkEnabled. Use FeatureConfig instead.
  224. A default port number is now retrieved from FeatureConfig.
  225. * src/main.cc
  226. (HaveEraseCommand.h): Included.
  227. (showVersion): Added the output of feature list.
  228. (main): Added HaveEraseCommand to command queue in BitTorrent
  229. downloading.
  230. * src/PeerInteractionCommand.h
  231. (chokeCheckPoint): Commented out.
  232. (periodicExecPoint): New variable.
  233. * src/PeerInteractionCommand.cc
  234. (executeInternal): Following methods are now called in at least every
  235. 0.5 seconds to reduce CPU usage:
  236. detectMessageFlooding(), peerInteraction->checkRequestSlot(),
  237. checkHave(), sendKeepAlive().
  238. (checkLongTimePeerChoking): Commented out.
  239. * src/BitfieldMan.h
  240. (getNthBitIndex): Changed the method signature.
  241. (getMissingIndexRandomly): Changed the method signature.
  242. * src/BitfieldMan.cc
  243. (getNthBitIndex): Rewritten
  244. (getMissingIndexRandomly): Rewritten.
  245. (hasMissingPiece): Rewritten.
  246. (getMissingIndex): Refactored.
  247. (getMissingUnusedIndex); Refactored.
  248. (getMissingIndex): Refactored.
  249. 2006-07-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  250. * src/PeerMessage.h
  251. (Piece.h): Included.
  252. (SharedHandle.h): Included.
  253. (invalidate): New variable.
  254. (uploading): New variable.
  255. (isInvalidate): New function.
  256. (isUploading): New function.
  257. (onPush): New function.
  258. (onChoked): New function.
  259. (onCanceled): New function.
  260. (onAbortPiece): New function.
  261. (PeerMessageHandle): New type definition.
  262. * src/PeerMessage.cc
  263. (PeerMessage): Added the initialization for invalidate and uploading.
  264. * src/CancelMessage.h
  265. (CancelMessage): Rewritten.
  266. * src/RejectMessage.h
  267. (RejectMessage): Rewritten.
  268. * src/Metalinker.h
  269. (operator=): Defined.
  270. * src/MetaEntry.h
  271. (operator=): Defined.
  272. * src/MetalinkResource.h
  273. (operator=): Defined.
  274. * src/AllowedFastMessage.h
  275. (AllowedFastMessage): Rewritten.
  276. * src/HandshakeMessage.h
  277. (HandshakeMessage): New function(overload).
  278. * src/HandshakeMessage.cc
  279. (HandshakeMessage): Rewritten.
  280. (init): New function.
  281. * src/HaveMessage.h
  282. (HaveMessage): Rewritten.
  283. * src/Time.h
  284. (operator=): Defined the function body here.
  285. * src/Time.cc
  286. (operator=): Removed.
  287. * src/SocketCore.h
  288. (operator==): Defined here.
  289. (operator!=): Defined here.
  290. (operator<): Defined here.
  291. * src/SocketCore.cc
  292. (operator==): Removed.
  293. (operator<): Removed.
  294. * src/BitfieldMan.h
  295. (operator=): Defined the function body here.
  296. * src/BitfieldMan.cc
  297. (operator=): Removed.
  298. * src/TorrentMan.h
  299. (deleteErrorPeer): Removed.
  300. (deleteUnusedPeer); New function.
  301. * src/TorrentMan.cc
  302. (addPeer): Call deleteUnusedPeer.
  303. (deleteErrorPeer): Removed.
  304. (deleteUnusedPeer): New function.
  305. * src/PeerAbstractCommand.h
  306. (setNoCheck): New function.
  307. (noCheck): New variable.
  308. * src/PeerAbstractCommand.cc
  309. (PeerAbstractCommand): Added the initialization of noCheck.
  310. (execute): Added a check for noCheck.
  311. (setNoCheck): New function.
  312. * src/Util.h
  313. (stdio.h): Included.
  314. * src/Util.cc
  315. (unistd.h): Included.
  316. * src/DefaultDiskWriter.cc
  317. (unistd.h): Included.
  318. * src/Peer.h
  319. (operator==): Defined the function body here.
  320. (operator!=): Defined the function body here.
  321. * src/Peer.cc
  322. (operator==): Removed.
  323. (operator!=): Removed.
  324. * src/Piece.h
  325. (Piece): Defined the function body here(copy constructor).
  326. (operator=): Defined the function body here.
  327. (operator==): Defined the function body here.
  328. * src/Piece.cc
  329. (Piece): Removed(copy constructor).
  330. (operator=): Removed.
  331. (operator==): Removed.
  332. * src/PeerMessageUtil.h
  333. (ChokeMessage.h): Removed.
  334. (UnchokeMessage.h): Removed.
  335. (InterestedMessage.h): Removed.
  336. (NotInterestedMessage.h): Removed.
  337. (HaveMessage.h): Removed.
  338. (BitfieldMessage.h): Removed.
  339. (RequestMessage.h): Removed.
  340. (CancelMessage.h): Removed.
  341. (PieceMessage.h): Removed.
  342. (HandshakeMessage.h): Removed.
  343. (KeepAliveMessage.h): Removed.
  344. (PortMessage.h): Removed.
  345. (HaveAllMessage.h): Removed.
  346. (HaveNoneMessage.h): Removed.
  347. (PeerConnection.h): Removed.
  348. (HandshakeMessage.h): Included.
  349. * src/BitfieldMessage.h
  350. (init): New function.
  351. (BitfieldMessage): Rewritten.
  352. (BitfieldMessage): New function(overload).
  353. * src/RequestSlot.h
  354. (operator=): Defined the function body here.
  355. (operator==): Defined the function body here.
  356. * src/RequestSlot.cc
  357. (operator=): Removed.
  358. (operator==): Removed.
  359. To remove the dependency on the PeerMessage subclass from
  360. PeerInteraction:
  361. * src/PeerMessageFactory.h: New class.
  362. * src/PeerMessageFactory.cc: New class.
  363. * src/SimplePeerMessage.cc
  364. (send): If invalidate is true then do nothing.
  365. * src/PeerInteractionCommand.cc
  366. (HandshakeMessage.h): Included.
  367. (KeepAliveMessage.h): Included.
  368. (ChokeMessage.h): Included.
  369. (UnchokeMessage.h): Included.
  370. (HaveMessage.h): Included.
  371. (executeInternal): Call setNoCheck().
  372. Removed setWriteCheckSocket(socket).
  373. * src/PeerInteraction.h
  374. (ChokeMessage.h): Removed.
  375. (UnchokeMessage.h): Removed.
  376. (InterestedMessage.h): Removed.
  377. (NotInterestedMessage.h): Removed.
  378. (HaveMessage.h): Removed.
  379. (BitfieldMessage.h): Removed.
  380. (RequestMessage.h): Removed.
  381. (CancelMessage.h): Removed.
  382. (PieceMessage.h): Removed.
  383. (HandshakeMessage.h): Removed.
  384. (KeepAliveMessage.h): Removed.
  385. (PortMessage.h): Removed.
  386. (HaveAllMessage.h): Removed.
  387. (HaveNoneMessage.h): Removed.
  388. (RejectMessage.h): Removed.
  389. (AllowedFastMessage.h): Removed.
  390. (SuggestPieceMessage.h): Removed.
  391. (PeerMessageFactory.h): Included.
  392. (PeerMessageHandle): Removed typedef of PeerMessageHandle.
  393. (HandshakeMessageHandle): Removed typedef of HandshakeMessageHandle.
  394. (PeerMessageFactory): New variable.
  395. (createPeerMessage): Removed.
  396. (createHandshakeMessage): Removed.
  397. (setPeerMessageCommonProperty): Removed.
  398. (addRequestSlot): New function.
  399. (receiveHandshake): Changed the return value type to PeerMessageHandle.
  400. (getPeerMessageFactory): New function.
  401. (createRequestMessage): Removed.
  402. (createCancelMessage): Removed.
  403. (createPieceMessage): Removed.
  404. (createHaveMessage): Removed.
  405. (createChokeMessage): Removed.
  406. (createUnchokeMessage): Removed.
  407. (createInterestedMessage): Removed.
  408. (createNotInterestedMessage): Removed.
  409. (createBitfieldMessage): Removed.
  410. (createKeepAliveMessage): Removed.
  411. (createHaveAllMessage): Removed.
  412. (createHaveNoneMessage): Removed.
  413. (createRejectMessage): Removed.
  414. (createAllowedFastMessage): Removed.
  415. * src/PeerInteraction.cc
  416. (PeerInteraction): Allocate PeerMessageFactory here.
  417. (~PeerInteraction): Deallocate PeerMessageFactory here.
  418. (sendMessages): Use msg->isUploading() instead of msg->getId() ==
  419. PieceMessage::ID.
  420. (addMessage): Simplified by using PeerMessage::onPush().
  421. (addRequestSlot): New function.
  422. (rejectAllPieceMessageInQueue): Simplified by using
  423. PeerMessage::onChoked().
  424. (rejectPieceMessageInQueue): Simplified by using
  425. PeerMessage::onCanceled().
  426. (abortPiece): Simplified by using PeerMessage::abortPiece().
  427. (receiveHandshake): Changed the return value type to PeerMessageHandle.
  428. (createHandshakeMessage): Removed.
  429. (createPeerMessage): Removed.
  430. (sendHandshake): Call PeerMessageFactory::createHandshakeMessage().
  431. (setPeerMessageCommonProperty): Removed.
  432. (createRequestMessage): Removed.
  433. (createCancelMessage): Removed.
  434. (createPieceMessage): Removed.
  435. (createHaveMessage): Removed.
  436. (createChokeMessage): Removed.
  437. (createUnchokeMessage): Removed.
  438. (createInterestedMessage): Removed.
  439. (createNotInterestedMessage): Removed.
  440. (createBitfieldMessage): Removed.
  441. (createKeepAliveMessage): Removed.
  442. (createHaveAllMessage): Removed.
  443. (createHaveNoneMessage): Removed.
  444. (createRejectMessage): Removed.
  445. (createAllowedFastMessage): Removed.
  446. * src/PieceMessage.h
  447. (createRejectMessage): New function.
  448. (PieceMessage): Rewritten.
  449. (onChoked): New function.
  450. (onCanceled): New function.
  451. * src/PieceMessage.cc
  452. (send): If invalidate is true then do nothing, just return.
  453. (createRejectMessage): New function.
  454. (onChoked): New function.
  455. (onCanceled): New function.
  456. * src/RequestMessage.h
  457. (RequestMessage): Rewritten.
  458. (onPush): New function.
  459. (onAbortPiece): New function.
  460. * src/RequestMessage.cc
  461. (onPush): New function.
  462. (onAbortPiece): New function.
  463. Update fd_set when a socket is added or deleted in order to improve
  464. performance:
  465. * src/DownloadEngine.h
  466. (rfdset): New variable.
  467. (wfdset): New variable.
  468. (updateFdSet): New function.
  469. * src/DownloadEngine.cc
  470. (SetDescriptor::operator()): Use SockCmdMap::value_type.
  471. (AccumulateActiveCommandUuid::operator()): Use SockCmdMap::value_type.
  472. (waitData): Copy rfdset and wfdset.
  473. (updateFdSet): New function.
  474. (addSocket): Call updateFdSet.
  475. (deleteSocket): Call updateFdSet.
  476. 2006-07-21 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  477. To add the support for Metalink3.0 backward compatible links:
  478. * src/Request.h
  479. (SAFE_CHARS): Added '#'.
  480. (METALINK_MARK): New definition.
  481. * src/Request.cc
  482. (parseUrl): Added the support for Metalink3.0 backward compatible
  483. links.
  484. etc
  485. * src/PeerInteraction.cc
  486. (MsgPushBack): Removed.
  487. (sendMessages): Use STL copy and back_inserter.
  488. (rejectAllPieceMessageInQueue): Use STL copy and back_inserter.
  489. (rejectPieceMessageInQueue): Use STL copy and back_inserter.
  490. * src/TorrentMan.h
  491. (MAX_PEER_LIST_SIZE): Changed to 100 from 250.
  492. 2006-07-19 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  493. * src/SharedHandle.h: New class.
  494. To wrap Socket, Command, PeerMessage and Peer with SharedHandle:
  495. * src/HttpResponseCommand.h
  496. (HttpResponseCommand): Wrapped Socket.
  497. * src/SocketCore.h
  498. (operator==): New function.
  499. (operator!=): New function.
  500. (operator<): New function.
  501. (getSockfd): New function.
  502. (isOpen): New function.
  503. (writeData): New function.
  504. * src/SocketCore.cc
  505. (operator==): New function.
  506. (operator!=): New function.
  507. (operator<): New function.
  508. * src/AbstractCommand.h
  509. (socket): Changed its type to SocketHandle.
  510. (setReadCheckSocket): Replaced Socket with SocketHandle.
  511. (setWriteCheckSocket): Replaced Socket with SocketHandle.
  512. (disableReadCheckSocket): New function.
  513. (disableWriteCheckSocket): New function.
  514. (readCheckTarget): Changed its type to SocketHandle.
  515. (writeCheckTarget): Changed its type to SocketHandle.
  516. (AbstractCommand): Replaced Socket with SocketHandle.
  517. * src/AbstractCommand.cc
  518. (AbstractCommand): Replaced Socket with SocketHandle.
  519. (~AbstractCommand): Removed the deallocation for Socket object.
  520. (disableReadCheckSocket): New function.
  521. (setReadCheckSocket): Replaced Socket with SocketHandle.
  522. (disableWriteCheckSocket): New function.
  523. (setWriteCheckSocket): Replaced Socket with SocketHandle.
  524. * src/HttpDownloadCommand.cc
  525. (DownloadCommand): Replaced Socket with SocketHandle.
  526. * src/PeerAbstractCommand.h
  527. (socket): Changed its type to SocketHandle.
  528. (peer): Changed its type to PeerHandle.
  529. (setReadCheckSocket): Replaced Socket with SocketHandle.
  530. (setWriteCheckSocket): Replaced Socket with SocketHandle.
  531. (disableReadCheckSocket): New function.
  532. (disableWriteCheckSocket): New function.
  533. (readCheckTarget): Changed its type to SocketHandle.
  534. (writeCheckTarget): Changed its type to SocketHandle.
  535. (PeerAbstractCommand): Replaced Socket with SocketHandle.
  536. Replaced Peer with PeerHandle.
  537. * src/HttpRequestCommand.cc
  538. (HttpRequestCommand): Replaced Socket with SocketHandle.
  539. Use disableReadCheckSocket.
  540. * src/PeerInitiateConnectionCommand.h
  541. (PeerInitiateConnectionCommand): Replaced Peer with PeerHandle.
  542. * src/PeerChokeCommand.cc
  543. (UploadFaster::operator()): Replaced Peer with PeerHandle.
  544. (DownloadFaster::operator()): Replaced Peer with PeerHandle.
  545. (execute): Use PeerHandle.
  546. * src/PeerConnection.h
  547. (HandshakeMessage.h): Removed include of HandshakeMessage.h.
  548. (socket): Changed its type to SocketHandle.
  549. (PeerConnection): Replaced Socket with SocketHandle.
  550. * src/PeerConnection.cc
  551. (PeerConnection): Replaced Socket with SocketHandle.
  552. * src/PeerInteractionCommand.h
  553. (PeerInteractionCommand): Replaced socket with SocketHandle.
  554. Replaced Peer with PeerHandle.
  555. * src/PeerInteractionCommand.cc
  556. (PeerInteractionCommand): Replaced Socket with SocketHandle.
  557. Replaced Peer with PeerHandle.
  558. (executeInternal): Use disableWriteCheckSocket.
  559. Use HandshakeMessageHandle.
  560. (receiveMessages): Use PeerMessageHandle.
  561. (prepareForNextPeer): Use PeerHandle.
  562. * src/HttpProxyRequestCommand.h
  563. (HttpProxyRequestCommand): Replaced Socket with SocketHandle.
  564. * src/HttpResponseCommand.cc
  565. (HttpResponseCommand): Replaced Socket with SocketHandle.
  566. * src/TorrentMan.cc
  567. (nullPeer): Added external reference.
  568. (~TorrentMan): Removed the deallocation of the elements of peers.
  569. (addPeer): Rewritten.
  570. (isPeerAvailable): Use nullPeer.
  571. (deleteOldpeers): Replaced with deleteErrorPeer.
  572. (deleteErrorPeer): New function.
  573. (getPeer): Use PeerHandle and nullPeer.
  574. (hasMissingPiece): Replaced Peer with PeerHandle.
  575. (getMissingPieceIndex): Replaced Peer with PeerHandle.
  576. (getMissingFastPieceIndex): Replaced Peer with PeerHandle.
  577. (getMissingFastPiece): Replaced Peer with PeerHandle.
  578. (getMissingPiece): Replaced Peer with PeerHandle.
  579. * src/FtpNegotiateCommand.cc
  580. (FtpNegotiationCommand): Replaced Peer with PeerHandle.
  581. (~FtpNegotiationCommand): Removed the deallocation of Sockets.
  582. (recvGreeting): Use disableWriteCheckSocket.
  583. (recvPasv): Removed the allocation of Socket.
  584. Use disableReadCheckSocket.
  585. (sendRestPasv): Use disableWriteCheckSocket.
  586. (recvRetr): Changed assertion.
  587. * src/PeerInteraction.h
  588. (SharedHandle.h): Included SharedHandle.h.
  589. (PeerMessageHandle): New type definition.
  590. (HandshakeMessageHandle): New type definition.
  591. (MessageQueue): Changed. Now its element is of type PeerMessageHandle.
  592. (peer): Changed its type to PeerHandle.
  593. (createHandshakeMessage): Replaced HandshakeMessage with
  594. HandshakeMessageHandle.
  595. (createPeerMessage): Replaced PeerMessageHandle with PeerMessage.
  596. (PeerInteraction): Replaced Peer with PeerHandle.
  597. Replaced Socket with SocketHandle.
  598. (addMessage): Replaced PeerMessage with PeerMessageHandle.
  599. (receiveMessage): Replaced PeerMessage with PeerMessageHandle.
  600. (receiveHandshake): Replaced HandshakeMessage with
  601. HandshakeMessageHandle.
  602. * src/PeerInteraction.cc
  603. (PeerInteraction): Replaced Peer with PeerHandle.
  604. Replaced Socket with SocketHandle.
  605. (~PeerInteraction): Removed the deallocation of the elements of
  606. messageQueue.
  607. (MsgPushBack::operator()): Replaced PeerMessage with PeerMessageHandle.
  608. (isSendingMessageInProgress): Replaced PeerMessage with
  609. PeerMessageHandle.
  610. (sendMessages): Use PeerMessageHandle. Removed try-catch block.
  611. (addMessage): Replaced PeerMessage with PeerMessageHandle.
  612. (rejectAllPieceMessageInQueue): Use PeerMessageHandle.
  613. (rejectPieceMessageInQueue): Use PeerMessageHandle.
  614. (abortPiece): Use PeerMessageHandle.
  615. (receiveHandshake): Replaced HandshakeMessage with
  616. HandshakeMessageHandle. Removed try-catch block.
  617. (createHandshakeMessage): Replaced HandshakeMessage with
  618. HandshakeMessageHandle.
  619. (receiveMessage): Replaced PeerMessage with PeerMessageHandle.
  620. Removed try-catch block.
  621. (createPeerMessage): Replaced PeerMessage with PeerMessageHandle.
  622. * src/HttpProxyResponseCommand.cc
  623. (HttpProxyRequestCommand): Replaced Socket with SocketHandle.
  624. * src/FtpTunnelResponseCommand.h
  625. (FtpTunnelResponseCommand): Replaced Socket with SocketHandle.
  626. * src/HttpConnection.cc
  627. (HttpConnection): Replaced Socket with SocketHandle.
  628. * src/PeerAbstractCommand.cc
  629. (PeerAbstractCommand): Replaced Socket with SocketHandle.
  630. (~PeerAbstractCommand): Removed the deallocation of socket.
  631. Use disableReadCheckSocket, disableWriteCheckSocket.
  632. (disableReadCheckSocket): New function.
  633. (setReadCheckSocket): Replaced Socket with SocketHandle.
  634. (disableWriteCheckSocket): New function.
  635. (setWriteCheckSocket): Replaced Socket with SocketHandle.
  636. * src/InitiateConnectionCommandFactory.h: Corrected indentation.
  637. * src/FtpTunnelRequestCommand.cc
  638. (FtpTunnelRequestCommand): Replaced Socket with SocketHandle.
  639. (~FtpTunnelRequestCommand): Corrected indentation.
  640. * src/DownloadCommand.h
  641. (DownloadCommand): Replaced Socket with SocketHandle.
  642. * src/PeerListenCommand.cc
  643. (PeerListenCommand): Removed the initialization of socket.
  644. (~PeerListenCommand): Removed the deallocation of socket.
  645. (bindPort): Use SocketHandle.
  646. (execute): Use SocketHandle and PeerHandle.
  647. * src/FtpDowndloadCommand.cc
  648. (FtpDownloadCommand): Replaced Socket with SocketHandle.
  649. (~FtpDownloadCommand): Removed the deallocation of ctrlSocket.
  650. * src/main.cc
  651. (main): Corrected indentation.
  652. * src/HttpInitiateConnectionCommand.cc
  653. (HttpInitiateConnectionCommand): Replaced Socket with SocketHandle.
  654. (executeInternal): Removed the allocation of socket.
  655. * src/HttpRequestCommand.h
  656. (HttpRequestCommand): Replaced Socket with SocketHandle.
  657. * src/FtpNegotiationCommand.h
  658. (dataSocket): Changed its type to SocketHandle.
  659. (serverSocket): Changed its type to SocketHandle.
  660. (FtpNegotiationCommand): Replaced Socket with SocketHandle.
  661. * src/TorrentMan.h
  662. (MAX_PEER_UPDATE): Removed.
  663. (MAX_PEERS): New definition.
  664. (Peers): The element is now of type PeerHandle.
  665. (addPeer): Replaced Peer with PeerHandle. Removed 'duplicate' argument.
  666. (getPeer): Replaced Peer with PeerHandle.
  667. (deleteOldErrorPeers): Removed.
  668. (deleteErrorPeer): New function.
  669. (hasMissingPiece): Replaced Peer with PeerHandle.
  670. (getMissingPieceIndex): Replaced Peer with PeerHandle.
  671. (getMissingPiece): Replaced Peer with PeerHandle.
  672. (getMissingFastPieceIndex): Replaced Peer with PeerHandle.
  673. (getMissingFastPiece): Replaced Peer with PeerHandle.
  674. (addActivePeer): Replaced Peer with PeerHandle.
  675. (deleteActivePeer): Replaced Peer with PeerHandle.
  676. Added a check for the return value of find.
  677. * src/FtpTunnelResponseCommand.cc
  678. (FtpTunnelResponseCommand): Replaced Socket with SocketHandle.
  679. * src/FtpInitiateConnectionCommand.cc
  680. (executeInternal): Removed the allocation of socket.
  681. * src/DownloadEngine.h
  682. (Sockets): An element is now of type SocketHandle.
  683. (SockCmdMap): A key is of type SocketHandle, a value is of type int.
  684. (CommandUuids): New type definition.
  685. (rsockets): Changed its type to SockCmdMap.
  686. (wsockets): Changed its type to SockCmdMap.
  687. (addSocket): Rewritten.
  688. (deleteSocket): Rewritten.
  689. (addSocketForReadCheck): Rewritten.
  690. (deleteSocketForReadCheck): Rewritten.
  691. (addSocketForWriteCheck): Rewritten.
  692. (deleteSocketForWriteCheck): Rewritten.
  693. (PairFind): New template class.
  694. * src/HttpDownloadCommand.h
  695. (HttpDownloadCommand): Replaced Socket with SocketHandle.
  696. * src/FtpConnection.cc
  697. (FtpConnection): Replaced Socket with SocketHandle.
  698. (sendPort): Removed the allocation of serverSocket. Removed try-catch
  699. block.
  700. * src/InitiateConnectionCommandFactory.cc
  701. (DlAbortEx.h): Included DlAbortEx.h.
  702. (createInitiateConnectionCommand): Throw exception if the protocol of
  703. requested URI is not supported.
  704. * src/Peer.cc
  705. (nullPeer): Changed its type to PeerHandle.
  706. (operator==): New function.
  707. (operator!=): New function.
  708. * src/Peer.h
  709. (SharedHandle.h): Included SharedHandle.h.
  710. (operator==): New function.
  711. (operator!=): New function.
  712. (Peer): Added the default constructor.
  713. Use resetStatus() to initialize member variables.
  714. (nullPeer): Removed.
  715. * src/TrackerUpdateCommand.cc
  716. (execute): Brushed up using SharedHandle. Replaced MAX_PEER_UPDATE
  717. with MIN_PEERS.
  718. * src/PeerListenCommand.h
  719. (socket): Changed its type to SocketHandle.
  720. * src/Command.h
  721. (CommandUuid): New type definition.
  722. (uuid): New variable.
  723. (uuidGen): New variable.
  724. (Command): Added the initialization of uuid.
  725. (getUuid): New function.
  726. * src/Socket.h
  727. (Socket): Removed.
  728. (SocketHandle): New type definition.
  729. * src/DownloadEngine.h
  730. (FindCommand): New function object.
  731. (run): The portion of socket check was rewritten.
  732. (SetDescriptor): New function object.
  733. (AccumulateActiveCommandUuid): New function object.
  734. (waitData): Rewritten.
  735. (addSocket): Rewritten.
  736. (deleteSocket): Rewritten.
  737. (addSocketForReadCheck): Rewritten.
  738. (addSocketForWriteCheck): Rewritten.
  739. (deleteSocketForReadCheck): Rewritten.
  740. (deleteSocketForWriteCheck): Rewritten.
  741. * src/HttpProxyResponseCommand.h
  742. (HttpProxyResponseCommand): Replaced Socket with SocketHandle.
  743. * src/HttpConnection.h
  744. (socket): Changed its type to SocketHandle.
  745. (HttpConnection): Replaced Socket with SocketHandle.
  746. * src/PeerInitiateConnectionCommand.cc
  747. (PeerInitiateConnectionCommand): Replaced Peer with PeerHandle.
  748. (executeInternal): Removed the allocation of socket.
  749. (prepareForNextPeer): Use PeerHandle.
  750. * src/PeerMessage.h
  751. (peer): Changed its type to PeerHandle.
  752. (getPeer): Replaced Peer with PeerHandle.
  753. (setPeer): Replaced Peer with PeerHandle.
  754. * src/DownloadCommand.cc
  755. (DownloadCommand): Replaced Socket with SocketHandle.
  756. * src/FtpConnection.h
  757. (socket): Changed its type to SocketHandle.
  758. (FtpConnection): Replaced Socket with SocketHandle.
  759. (sendPort); Replaced Socket with SocketHandle.
  760. * src/FtpDowndloadCommand.h
  761. (ctrlSocket): Changed its type to SocketHandle.
  762. (FtpDownloadCommand): Replaced Socket with SocketHandle.
  763. * src/HttpProxyRequestCommand.cc
  764. (HttpProxyRequestCommand): Replaced Socket with SocketHandle.
  765. * src/FtpTunnelRequestCommand.h
  766. (FtpTunnelRequestCommand): Replaced Socket with SocketHandle.
  767. etc
  768. * src/PeerChokeCommand.h
  769. (setAllPeerChoked): Removed.
  770. (setAllPeerResetDelta): Removed.
  771. * src/PeerChokeCommand.cc
  772. (setAllPeerChoked): Removed.
  773. (ChokePeer): New function object.
  774. (setAllPeerResetDelta): Removed.
  775. (ResetDelta): New function object.
  776. (orderByDownloadRate): Fixed a bug: use DowloadFaster, not UploadFaster
  777. (execute): Show download speed when the local node is a seeder.
  778. setAllPeerChoked and setAllPeerResetDelta were rewritten
  779. using STL.
  780. * src/TrackerWatcherCommand.h
  781. (MIN_PEERS): Removed.
  782. * src/TorrentMan.cc
  783. (getPeer): Replaced MAX_PEER_UPDATE with MIN_PEERS.
  784. 2006-07-07 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  785. To fix the bug that .aria2 file is not saved if downloading is stopped
  786. by the errors:it results that aria2 can not resume downloading:
  787. * src/main.cc
  788. (normalDownload): Added the call to save().
  789. (main): Added the deletion of the elements in 'reserved'.
  790. To fix log:
  791. * src/PeerInteraction.cc
  792. (receiveHandshake): Fixed log.
  793. 2006-07-05 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  794. To improve download performance in BitTorrent:
  795. * src/TorrentMan.cc
  796. (getPeer): Check the number of connections. Return nullPeer if
  797. it is greater than MAX_PEER_UPDATE.
  798. This code was originally here, but was removed in 0.5.1.
  799. 2006-07-04 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  800. To improve the conditional compilation:
  801. * src/MultiDiskWriter.h:
  802. Replaced ENABLE_SHA1DIGEST with ENABLE_MESSAGE_DIGEST.
  803. * src/MultiDiskWriter.cc:
  804. Replaced ENABLE_SHA1DIGEST with ENABLE_MESSAGE_DIGEST.
  805. * src/Util.h:
  806. Replaced ENABLE_SHA1DIGEST with ENABLE_MESSAGE_DIGEST.
  807. Added ENABLE_BITTORRENT around computeFastSet().
  808. * src/Util.cc:
  809. Replaced ENABLE_SHA1DIGEST with ENABLE_MESSAGE_DIGEST.
  810. Added ENABLE_BITTORRENT around computeFastSet().
  811. * src/messageDigest.h:
  812. Replaced ENABLE_BITTORRENT with ENABLE_SSL.
  813. * src/ShaVisitor.h:
  814. Replaced ENABLE_SHA1DIGEST with ENABLE_MESSAGE_DIGEST.
  815. * src/ShaVisitor.cc:
  816. Replaced ENABLE_SHA1DIGEST with ENABLE_MESSAGE_DIGEST.
  817. * src/main.cc:
  818. Added ENABLE_BITTORRENT around includes and blocks related to
  819. BitTorrent.
  820. Added ENABLE_MESSAGE_DIGEST to skip checksum checking when the message
  821. digest support is not available.
  822. * src/AbstractDiskWriter.h:
  823. Replaced ENABLE_SHA1DIGEST with ENABLE_MESSAGE_DIGEST.
  824. * src/AbstractDiskWriter.cc:
  825. Replaced ENABLE_SHA1DIGEST with ENABLE_MESSAGE_DIGEST.
  826. * src/MetalinkEntry.cc
  827. (check): Added ENABLE_MESSAGE_DIGEST. Return true if the message digest
  828. support is not available.
  829. To add command-line options for Metalink:
  830. * src/main.cc:
  831. Added metalink-version, metalink-language, metalink-os,
  832. follow-metalink.
  833. To use EXIT_SUCCESS and EXIT_FAILURE with exit():
  834. * src/main.cc: Use these definition.
  835. * Release 0.6.0
  836. 2006-07-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  837. To add Metalink support(http/ftp only):
  838. * src/AbstractCommand.h
  839. (tryReserved): New function.
  840. * src/AbstractCommand.cc
  841. (execute): Call tryReserved().
  842. (tryReserved): New function.
  843. * src/Request.h
  844. (Requests): New type definition.
  845. * src/SegmentMan.h
  846. (reserved): New variable.
  847. * src/Util.h
  848. (fileChecksum): New function.
  849. (toUpper): New function.
  850. (toLower): New function.
  851. * src/Util.cc
  852. (messageDigest.h): Included.
  853. (trim): Trim \r\n\t.
  854. (fileChecksum): New function.
  855. (toUpper): New function.
  856. (toLower): New function.
  857. * src/main.cc
  858. (normalDownload): New function.
  859. (main): Added 2 command-line options: metalink-file,
  860. metalink-connection. Their usage has not been written yet.
  861. * src/MetalinkProcessor.h: New class.
  862. * src/Xml2MetalinkProcessor.h: New class.
  863. * src/Xml2MetalinkProcessor.cc: New class.
  864. * src/MetalinkEntry.h: New class.
  865. * src/MetalinkEntry.cc: New class.
  866. * src/MetalinkResource.h: New class.
  867. * src/MetalinkResource.cc: New class.
  868. To add md5 message digest checking:
  869. * src/messageDigest.h: Rewritten.
  870. * src/MultiDiskWriter.cc: Updated according to the changes in
  871. messageDigest.h.
  872. * src/ShaVisitor.cc: Updated according to the changes in
  873. messageDigest.h.
  874. * src/Util.cc: Updated according to the changes in messageDigest.h.
  875. * src/AbstractDiskWriter.cc: Updated according to the changes in
  876. messageDigest.h.
  877. To fix a bug that causes segfault when the payload length in peer
  878. message is less than 0:
  879. * src/PeerConnection.cc:
  880. (receiveMessage): Fixed the bug.
  881. * src/PeerMessageUtil.cc
  882. (checkLength): Throw an exception if length is less than or equals to
  883. 0.
  884. To add new interfaces to Base64 encoding/decoding:
  885. * src/Base64.h
  886. (part_encode): Changed the method signature.
  887. (encode): New function(overload).
  888. (decode): New function(overload).
  889. * src/Base64.cc
  890. (part_encode): Rewritten.
  891. (encode): Rewritten.
  892. (encode): New function(overload).
  893. To prevent a peer to download same piece if there is an error in
  894. checksum:
  895. * src/PieceMessage.cc
  896. (receivedAction): Call peerInteraction->abortPiece().
  897. 2006-06-25 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  898. To fix the bug that causes same have message is sent many times to
  899. a single peer.
  900. * src/Time.cc
  901. (isNewer): Use Util::difftv().
  902. * src/Util.cc
  903. (difftv): Added a cast to (long long int).
  904. * src/TorrentMan.cc
  905. (advertisePiece): Use push_front.
  906. (getAdvertisedPieceIndexes): A performance improvement was made.
  907. To fix the bug that sends tracker requests without a sleep interval
  908. when the number of connections is less than 15.
  909. * src/TrackerWatcherCommand.cc
  910. (execute): Now the number of connections is not a factor to decide
  911. whether or not a tracker request should be sent or not.
  912. * src/Time.h
  913. (setTimeInSec): New function.
  914. * src/Time.cc
  915. (setTimeInSec): New function.
  916. etc.
  917. * src/ChokeMessage.cc
  918. (receivedAction): Removed peer->snubbing = false
  919. * src/PeerConnection.h
  920. (receiveHandshake): Updated doc.
  921. * src/TorrentMan.h
  922. (getAdvertisedPieceIndexes): Updated the method signature.
  923. * src/TorrentMan.cc
  924. (getAdvertisedPieceIndexes): Updated the method signature.
  925. * src/Time.h
  926. (getTimeInMicros): Added a cast to (long long int).
  927. (getTimeInMillis): Added a cast to (long long int).
  928. * Release 0.5.2
  929. 2006-06-22 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  930. To make a listening socket non-block:
  931. * src/SocketCore.h
  932. (setNonBlockingMode): New function.
  933. * src/SocketCore.cc
  934. (setNonBlockingMode): New function.
  935. (beginListen): Added a call to setNonBlockingMode().
  936. (acceptConnection): Call setNonBlockingMode().
  937. (setBlockingMode): Updated.
  938. To handle tracker's NAT-checking:
  939. * src/PeerConnection.cc
  940. (receiveHandshake): 'msg' param is filled with received data and
  941. its length is assigned to 'length' param, even if all handshake
  942. message is not yet received.
  943. * src/PeerInteractionCommand.cc
  944. (executeInternal): Use peerInteraction->receiveHandshake(true) when
  945. a new peer connects to localhost.
  946. A call to peerInteraction->sendHandshake() was removed because
  947. it is called from peerInteraction->receiveHandshake(true).
  948. * src/PeerInteraction.h
  949. (quickReplied): New variable.
  950. (receiveHandshake): Added an argument.
  951. * src/PeerInteraction.cc
  952. (PeerInteraction): Added the initialization of quickReplied.
  953. (receiveHandshake): Send handshake message as soon as the info hash
  954. in a handshake message from a peer is correct.
  955. To change the random part of peer id and key parameter:
  956. * src/TorrentMan.h
  957. (key): New variable.
  958. * src/TorrentMan.cc
  959. (setupInternal1): Use Util::randomAlpha() to generate random part
  960. of peer id, which is now "-aria2-"+13 alphabet characters([A-Za-z]).
  961. key is also generated by Util::randomAlpha() and it is now 8 character
  962. long.
  963. * src/Util.h
  964. (randomAlpha): New function.
  965. * src/Util.cc
  966. (randomAlpha): New function.
  967. * src/TrackerWatcherCommand.cc
  968. (execute): In a tracker request: Use torrentMan->key as key parameter.
  969. Added no_peer_id=1.
  970. Set snubbing flag to false when a choke message is received from a
  971. snubbed peer.
  972. * src/ChokeMessage.cc
  973. (receivedAction): Set snubbing flag to false.
  974. 2006-06-18 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  975. * src/TorrentMan.cc (setupInternal1): Fixed peerId generation bug.
  976. * src/SimpleLogger.h (writeHeader): New function.
  977. * src/SimpleLogger.cc (writeHeader): New function.
  978. (writeLog): Fixed the bug that causes segfaults if exception message
  979. contains an unescaped "%" character.
  980. * src/TrackerWatcherCommand.cc (execute): Added a short sleep
  981. when a tracker request fails.
  982. * src/Request.cc (parseUrl): Query string is now handled properly.
  983. * Release 0.5.1
  984. 2006-06-12 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  985. To add Time class which represents a specific instant in time and
  986. its precision is microseconds. Time checking procedures were rewritten
  987. using this object.
  988. * src/Time.h: New class.
  989. * src/Time.cc: New class.
  990. * src/AbstractCommand.h
  991. (updateCheckPoint): Removed.
  992. (isTimeoutDetected): Removed.
  993. (checkPoint): Changed the type to Time.
  994. (timeout): New variable.
  995. (setTimeout): New function.
  996. * src/AbstractCommand.cc
  997. (AbstractCommand): Removed the initialization of checkPoint.
  998. Added the initialization of timeout.
  999. (updateCheckPoint): Removed.
  1000. (isTimeoutDetected): Removed.
  1001. (execute): Use checkPoint.reset() and checkPoint.elapsed().
  1002. * src/PeerChokeCommand.h
  1003. (checkPoint): Changed the type to Time.
  1004. * src/PeerChokeCommand.cc
  1005. (PeerChokeCommand): Removed the initialization of checkPoint.
  1006. (execute): Rewritten using Time object.
  1007. * src/TrackerWatcherCommand.h
  1008. (checkPoint): Changed the type to Time.
  1009. * src/TrackerWatcherCommand.cc
  1010. (TrackerWatcherCommand): Removed the initialization of checkPoint.
  1011. (execute): Rewritten.
  1012. * src/ConsoleDownloadEngine.h
  1013. (cp): Changed the type to Time.
  1014. (startup): Changed the type to Time.
  1015. * src/ConsoleDownloadEngine.cc
  1016. (initStatistics): Use cp.reset(), startup.reset().
  1017. (calculateStatistics): Rewritten using Time object.
  1018. * src/PeerAbstractCommand.h
  1019. (updateCheckPoint): Removed.
  1020. (isTimeoutDetected): Removed.
  1021. (checkPoint): Changed the type to Time.
  1022. * src/PeerAbstractCommand.cc
  1023. (PeerAbstractCommand): Removed the initialization of checkPoint.
  1024. (updateCheckPoint): Removed.
  1025. (isTimeoutDetected): Removed.
  1026. (execute): Use checkPoint.reset() and checkPoint.elapsed().
  1027. * src/PeerInteractionCommand.cc
  1028. (PeerInteractionCommand): Removed the initializations of struct
  1029. timeval variables.
  1030. * src/PeerInteractionCommand.h
  1031. (keepAliveCheckPoint): Changed the type to Time.
  1032. (chokeCheckPoint): Changed the type to Time.
  1033. (freqCheckPoint): Changed the type to Time.
  1034. (haveCheckTime): Changed the type to Time.
  1035. * src/PeerInteractionCommand.cc
  1036. (executeInternal): Rewritten using Time object.
  1037. (detectMessageFlooding): Rewritten using Time object.
  1038. (checkLongTimePeerChoking): Rewritten using Time object.
  1039. (sendKeepAlive): Rewritten using Time object.
  1040. (checkHave): Rewritten using Time object.
  1041. * src/SleepCommand.h
  1042. (checkPoint): Changed the type to Time.
  1043. * src/SleepCommand.cc
  1044. (SleepCommand): Removed the initialization of checkPoint.
  1045. (execute): Rewritten using Time object.
  1046. * src/TorrentAutoSaveCommand.h
  1047. (checkPoint): Changed the type to Time.
  1048. * src/TorrentAutoSaveCommand.cc
  1049. (TorrentAutoSaveCommand): Removed the initialization of checkPoint.
  1050. (execute): Rewritten.
  1051. * src/DownloadCommand.h
  1052. (sw): Changed the type to Time.
  1053. * src/DownloadCommand.cc
  1054. (DownloadCommand): Removed the initialization of sw.
  1055. (executeInternal): Rewritten.
  1056. * src/RequestSlot.h
  1057. (dispatchedTime): Changed the type to Time.
  1058. * src/RequestSlot.cc
  1059. (RequestSlot): Removed the call to setDispatchedTime().
  1060. (setDispatchedTime): Rewirtten.
  1061. (isTimeout): Rewritten.
  1062. (getLatencyInMillis): Rewritten.
  1063. * src/TorrentDownloadEngine.h
  1064. (cp): Changed the type to Time[2].
  1065. (startup): Changed the type to Time.
  1066. * src/TorrentDownloadEngine.cc
  1067. (initStatistics): Rewritten.
  1068. (calculateStatistics): Rewritten.
  1069. * src/DownloadEngine.cc
  1070. (run): Rewritten.
  1071. To detect all attempts to connect to the tracker are failed:
  1072. * src/AbstractCommand.cc
  1073. (execute): Increment e->segmentMan->errors if a command aborted.
  1074. * src/SegmentMan.h
  1075. (errors): New variable.
  1076. * src/SegmentMan.cc
  1077. (SegmentMan): Added the initialization of errors.
  1078. (init): Added the initialization of errors.
  1079. * src/TrackerWatcherCommand.cc
  1080. (execute): If e->segmentMan->errors > 0 then assume that the tracker
  1081. request was failed.
  1082. To handle snubbed peers:
  1083. * src/PeerChokeCommand.cc
  1084. (optUnchokingPeer): Snubbed peers don't get unchoked.
  1085. (execute): Snubbed peers don't get unchoked.
  1086. * src/PeerInteraction.h
  1087. (REQUEST_TIME_OUT): Changed the value from 120 to 60.
  1088. * src/PeerInteraction.cc
  1089. (checkRequestSlot): A peer get marked as "snubbed" if it doesn't send
  1090. back the requested 16k block in 60 seconds.
  1091. * src/PieceMessage.cc
  1092. (receivedAction): A peer's snubbed state is cleard if it sends
  1093. the requested 16k block in 60 seconds.
  1094. * src/Peer.h
  1095. (snubbing): New variable.
  1096. * src/Peer.cc
  1097. (resetStatus): Added snubbed = false.
  1098. To fix the bug that causes have message is not sent:
  1099. * src/PeerInteractionCommand.cc
  1100. (~PeerInteractionCommand): Removed e->torrentMan->unadvertisePiece().
  1101. (FLOODING_CHECK_INTERVAL): New definition(temporal).
  1102. (detectMessageFlooding): Use FLOODING_CHECK_INTERVAL.
  1103. * src/TorrentMan.h
  1104. (HaveEntry): New class.
  1105. (advertisePiece): Rewritten.
  1106. (getAdvertisedPieceIndexes): Rewritten.
  1107. (Haves): Changed the type.
  1108. (getAdvertisedPieceIndexes): Added an argument.
  1109. Others:
  1110. * src/TorrentMan.h
  1111. (DEFAULT_ANNOUNCE_INTERVAL): Changed the value to 1800.
  1112. (DEFAULT_ANNOUNCE_MIN_INTERVAL): Changed the value to 1800.
  1113. * src/TorrentMan.cc
  1114. (getPeer): Don't check the number of connections here.
  1115. (setupInternal1): Changed peerId.
  1116. * src/PeerInteractionCommand.h
  1117. (KEEP_ALIVE_INTERVAL): New definition.
  1118. (sendKeepAlive): Use KEEP_ALIVE_INTERVAL.
  1119. * src/main.cc
  1120. (main): SA_ONESHOT was replaced with SA_RESETHAND.
  1121. * src/DownloadEngine.h: Removed unnecessary header includes.
  1122. 2006-05-29 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  1123. To fix the bug that causes segfaults if a tracker returns a zero-length
  1124. list as "peers":
  1125. * src/TrackerUpdateCommand.cc
  1126. (execute): Added a check to see wether the type of peers is Data*.
  1127. 2006-05-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  1128. * Release 0.5.0
  1129. To fix compile issue with gcc3:
  1130. * src/CancelMessage.h
  1131. (ID): Renamed as ID_t
  1132. (ID_t): New enum.
  1133. * src/RejectMessage.h
  1134. (ID): Renamed as ID_t
  1135. (ID_t): New enum.
  1136. * src/SuggestPieceMessage.h
  1137. (ID): Renamed as ID_t
  1138. (ID_t): New enum.
  1139. * src/AllowedFastMessage.h
  1140. (ID): Renamed as ID_t
  1141. (ID_t): New enum.
  1142. * src/PortMessage.h
  1143. (ID): Renamed as ID_t
  1144. (ID_t): New enum.
  1145. * src/HaveNoneMessage.h
  1146. (ID): Renamed as ID_t
  1147. (ID_t): New enum.
  1148. * src/KeepAliveMessage.h
  1149. (ID): Renamed as ID_t
  1150. (ID_t): New enum.
  1151. * src/HaveAllMessage.h
  1152. (ID): Renamed as ID_t
  1153. (ID_t): New enum.
  1154. * src/UnchokeMessage.h
  1155. (ID): Renamed as ID_t
  1156. (ID_t): New enum.
  1157. * src/BitfieldMessage.h
  1158. (ID): Renamed as ID_t
  1159. (ID_t): New enum.
  1160. * src/PieceMessage.h
  1161. (ID): Renamed as ID_t
  1162. (ID_t): New enum.
  1163. * src/RequestMessage.h
  1164. (ID): Renamed as ID_t
  1165. (ID_t): New enum.
  1166. * src/NotInterestedMessage.h
  1167. (ID): Renamed as ID_t
  1168. (ID_t): New enum.
  1169. * src/ChokeMessage.h
  1170. (ID): Renamed as ID_t
  1171. (ID_t): New enum.
  1172. * src/InterestedMessage.h
  1173. (ID): Renamed as ID_t
  1174. (ID_t): New enum.
  1175. * src/HaveMessage.h
  1176. (ID): Renamed as ID_t
  1177. (ID_t): New enum.
  1178. 2006-05-26 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  1179. * src/PeerAbstractCommand.h
  1180. (beforeSocketCheck): Removed.
  1181. * src/PeerAbstractCommand.cc
  1182. Modified in order to call executeInternal() even if socket check
  1183. and upload limit check fail.
  1184. * src/PeerInteractionCommand.h
  1185. (keepAlive): Removed.
  1186. (sendKeepAlive): New function.
  1187. (checkHave): New function.
  1188. (beforeSocketCheck): Removed.
  1189. * src/PeerInteractionCommand.cc
  1190. (executeInternal): Use peerInteraction->checkRequestSlot(). Added
  1191. calls to checkHave() and sendKeepAlive().
  1192. (keepAlive): Renamed to sendKeepAlive().
  1193. (sendKeepAlive): New function.
  1194. (beforeSocketCheck): Removed.
  1195. (checkHave): New function.
  1196. * src/BitfieldMan.cc
  1197. (getMissingIndex): Don't call getMissingIndexRandomly() if max is 0.
  1198. (getMissingUnusedIndex): Don't call getMissingIndexRandomly() if max is
  1199. 0.
  1200. (getMissingIndex): Dont't call getMissingIndexRandomly() if max is 0.
  1201. * src/TorrentMan.h
  1202. (UsedPieces): Removed.
  1203. (Pieces): New type definition.
  1204. * src/Piece.h: Updated doc.
  1205. * src/Peer.h
  1206. (totalLength): Removed.
  1207. * src/Peer.cc
  1208. (updateLatency): Fixed the latency calculation.
  1209. * src/TorrentMan.cc
  1210. (addPeer): Call deleteOldErrorPeers() only if peers.size() is higher
  1211. than or equal to MAX_PEER_LIST_SIZE.
  1212. If duplicate is false and peer.size() >= MAX_PEER_LIST_SIZE,
  1213. then return false.
  1214. (deleteOldErrorPeers): Rewritten.
  1215. (deleteUsedPiece): Fixed the miss use of STL remove.
  1216. * src/PeerInteraction.h
  1217. (Pieces): Removed.
  1218. (deleteTimeoutRequestSlot): Removed.
  1219. (deleteCompletedRequestSlot): Removed.
  1220. (checkRequestSlot): New function.
  1221. * src/PeerInteraction.cc
  1222. (deleteTimeoutRequestSlot): Merged to checkRequestSlot().
  1223. (deleteCompletedRequestSlot): Merged to checkRequestSlot().
  1224. (checkRequestSlot): New function.
  1225. * src/DownloadEngine.cc
  1226. (run): Clear activeSockets before calling waitData().
  1227. (waitData): Removed a call to activeSockets.clear().
  1228. 2006-05-24 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  1229. To attempt to handle EINTR:
  1230. * src/SocketCore.cc
  1231. (isReadable): Added EINTR handling.
  1232. (isWritable): Added EINTR handling.
  1233. To improve the performance:
  1234. * src/AbstractCommand.cc
  1235. (isTimeoutDetected): Use Util::difftvsec() instead of Util::difftv().
  1236. * src/PeerInteractionCommand.h
  1237. (receiveMessage): Renamed as receiveMessages().
  1238. (receiveMessages): New function.
  1239. * src/PeerInteractionCommand.cc
  1240. (executeInternal): receiveMessage loop is moved to new receiveMessages
  1241. () function. detectMessageFlooding() is moved here.
  1242. (detectMessageFlooding): Use Util::difftvsec() instead of Util::difftv
  1243. (). The flooding detection for have message is comment out.
  1244. (checkLongTimePeerChoking): Use Util::difftvsec() instead of
  1245. Util::difftv().
  1246. (receiveMessage): Renamed as receiveMessages().
  1247. (receiveMessages): New function.
  1248. (keepAlive): Use Util::difftvsec() instead of Util::difftv().
  1249. (beforeSocketCheck): Commented out checkLongTimePeerChoking().
  1250. * src/SleepCommand.cc
  1251. (execute): Use Util::difftvsec() instead of Util::difftv().
  1252. * src/BitfieldMan.h
  1253. (getNthBitIndex): New function.
  1254. (hasMissingPiece): New function.
  1255. (getAllMissingIndexes): New function.
  1256. * src/BitfieldMan.cc
  1257. (countSetBit): Rewritten.
  1258. (getNthBitIndex): New function.
  1259. (getMissingIndexRandomly): Rewritten.
  1260. (hasMissingPiece): New function.
  1261. (getAllMissingIndexes): New function.
  1262. * src/TorrentMan.cc
  1263. (hasMissingPiece): New function.
  1264. (deleteUsedPiece): Rewritten using STL.
  1265. * src/PeerInteraction.cc
  1266. (getNewPieceAndSendInterest): Use TorrentMan::hasMissingPiece(), which
  1267. is a little bit faster then TorrentMan::getMissingPieceIndex().
  1268. (addRequests): Updated the number of pending requests.
  1269. * src/PeerAbstractCommand.cc
  1270. (isTimeoutDetected): Use Util::difftvsec() instead of Util::difftv().
  1271. (execute): Returns true if TorrentMan::isHalt() is true.
  1272. Corrected the condition of upload limit checking.
  1273. * src/Util.h
  1274. (countBit): New function.
  1275. * src/Util.cc
  1276. (nbits): New variable.
  1277. (countBit): New function.
  1278. * src/DownloadEngine.h
  1279. (SockCmdMap): New type definition.
  1280. (waitData): Added an argument.
  1281. (addSocket): Added an argument.
  1282. (addSocketForReadCheck): Added an argument.
  1283. (addSocketForWriteCheck): Added an argument.
  1284. * src/DownloadEngine.cc
  1285. (run): Executes only commands whose sockets are ready to read or write.
  1286. All commands are executed in every 1 second.
  1287. (waitData): Calls select() again if it returned
  1288. EINTR.
  1289. (addSocket): Saves socket and command object pair to the map.
  1290. (deleteSocket): Deletes socket and command object pair from the map.
  1291. (addSocketForReadCheck): Added an argument.
  1292. (addSocketForWriteCheck): Added an argument.
  1293. * src/DownloadCommand.cc
  1294. (executeInternal): Use Util::difftvsec() instead of Util::difftv().
  1295. To send "event=stopped" to the tracker when the application finishes:
  1296. * src/PeerChokeCommand.h
  1297. (checkPoint): New variable.
  1298. * src/PeerChokeCommand.cc
  1299. (PeerChokeCommand): Added the initialization of checkPoint.
  1300. (execute): The interval check is now done by checkPoint, not
  1301. SleepCommand. Return true if TorrentMan::isHalt() is true.
  1302. * src/TorrentMan.h
  1303. (halt): New function.
  1304. (hasMissingPiece): New function.
  1305. (isHalt): New function.
  1306. (setHalt): New function.
  1307. * src/TorrentMan.cc
  1308. (TorrentMan): Added the initialization of halt.
  1309. * src/TorrentAutoSaveCommand.h
  1310. (checkPoint): New variable.
  1311. * src/PeerListenCommand.cc
  1312. (execute): Returns true if TorrentMan::isHalt() is true.
  1313. * src/main.cc
  1314. (setSignalHander): Added flags argument.
  1315. (torrentHandler): Just calls TorrentMan::setHalt(true) and returns.
  1316. (main): Set SA_ONESHOT flag of the signal hander of SIGINT and SIGTERM.
  1317. Removed printDownloadAbortMessage() after torrent downloading loop.
  1318. * src/TorrentAutoSaveCommand.cc
  1319. (TorrentAutoSaveCommand): Added the initialization of checkPoint.
  1320. (execute): Returns true if TorrentMan::isHalt() is true.
  1321. The interval check is now done by checkPoint, not SleepCommand.
  1322. * src/TrackerWatcherCommand.cc
  1323. (execute): If TorrentMan::isHalt(), then create a tracker request with
  1324. event=stopped.
  1325. * src/TrackerUpdateCommand.cc
  1326. (prepareForRetry): Do not use SleepCommand here.
  1327. (execute): Returns true if TorrentMan::isHalt() is true.
  1328. Others:
  1329. * src/TorrentMan.cc
  1330. (getMissingPieceIndex): Updated log message.
  1331. * src/PeerInteraction.cc
  1332. (createPeerMessag): Updated log message.
  1333. 2006-05-20 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  1334. To add the ability to download several pieces in mix in a command and
  1335. increase the number of request slots according to request-cancel
  1336. latency:
  1337. * src/PeerInteractionCommand.cc
  1338. (executeInternal): The number of messages to be received at a time
  1339. is increased from 10 to 50.
  1340. * src/LogFactory
  1341. (getInstance): Added NullLogger.
  1342. * src/NullLogger.h: New class.
  1343. * src/BitfieldMan.h
  1344. (getMissingIndex): New function.
  1345. * src/BitfieldMan.cc
  1346. (getMissingIndex): New function.
  1347. * src/TorrentMan.h
  1348. (checkOutPiece): New function.
  1349. (getMissingPieceIndex): New function.
  1350. (getMissingFastPieceIndex): New function.
  1351. (getMissingFastPiece): New function.
  1352. * src/TorrentMan.cc
  1353. (updatePiece): Rewritten using STL.
  1354. (syncPiece): Rewritten using STL.
  1355. (getMissingPiece): Rewritten using getMissingPieceIndex() and
  1356. checkOutPiece().
  1357. (getMissingPieceIndex): New function.
  1358. (getMissingFastPieceIndex): New function.
  1359. (getMissingFastPiece): New function.
  1360. (checkOutPiece): New function.
  1361. * src/PeerInteraction.h
  1362. (Pieces): New type definition.
  1363. (piece): Removed.
  1364. (pieces): New variable.
  1365. (getNewPieceAndSendInterest): Added the "piece" argument.
  1366. (abortPiece): Added the "piece" argument.
  1367. (abortAllPieces): New function.
  1368. (isInRequestSlot): New function.
  1369. (hasDownloadPiece): Added the "index" argument.
  1370. (setDownloadPiece): Removed.
  1371. (getDownloadPiece): Added the "index" argument.
  1372. (updatePiece): New function.
  1373. (createRequestMessage): Added the "index" argument.
  1374. * src/PeerInteraction.cc
  1375. (onChoked): Rewritten.
  1376. (abortPiece): Rewirtten.
  1377. (abortAllPieces): New function.
  1378. (deleteTimeoutRequestSlot): Rewritten.
  1379. Clarified code a little bit.
  1380. (deleteCompletedRequestSlot): Rewritten.
  1381. (isInRequestSlot): New function.
  1382. (syncPiece): Rewritten.
  1383. (updatePiece): New function.
  1384. (getNewPieceAndSendInterest): Rewritten.
  1385. (addRequests): Rewritten.
  1386. (getDownloadPiece): Rewritten.
  1387. (hasDownloadPiece): Rewritten.
  1388. (createRequestMessage): Added the "index" argument.
  1389. * src/common.h
  1390. (BITFIELD_LEN_FROM_PIECES): Enclosed the variable in parentheses.
  1391. (DIV_FLOOR): New definition.
  1392. * src/PieceMessage.cc
  1393. (receivedAction): Update request-piece latency here.
  1394. * src/RequestSlot.h
  1395. (getLatencyInMillis): New function.
  1396. * src/RequestSlot.cc
  1397. (isTimeout): Rewritten using getLatencyInMillis.
  1398. (getLatencyInMillis): New function.
  1399. * src/Piece.h
  1400. (operator==): New function.
  1401. (getMissingBlockIndex): New function.
  1402. * src/Piece.cc
  1403. (operator==): New function.
  1404. (getMissingBlockIndex): New function.
  1405. * src/Peer.h
  1406. (DEFAULT_LATENCY): New definition.
  1407. (latency): New variable.
  1408. (updateLatency): New function.
  1409. (getLatency): New function.
  1410. * src/Peer.cc
  1411. (resetStatus): Reset latecy.
  1412. (updateLatency): New function.
  1413. 2006-05-20 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  1414. * src/SocketCore.cc
  1415. (isReadable): Added secure to the condition.
  1416. * src/HttpConnection.cc
  1417. (receiveResponse): Fixed a bug that causes no response header
  1418. exception.
  1419. * src/Peer.h
  1420. (getFastSet): Fixed the return value type.
  1421. 2006-05-18 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  1422. To remove a wait from download loop:
  1423. * src/DownloadEngine.cc
  1424. (run): Comment out shortSleep.
  1425. To rewrite the message handling:
  1426. * src/SimplePeerMessage.h: New class.
  1427. * src/SimplePeerMessage.cc: New class.
  1428. * src/CancelMessage.h: Derived from SimplePeerMessage.
  1429. (msg): New variable.
  1430. (create): New function.
  1431. (send): Removed.
  1432. (getMessage): New function.
  1433. (getMessageLength): New function.
  1434. * src/CancelMessage.cc
  1435. (create): New function.
  1436. (receivedAction): Replaced deleteRequestMessageInQueue with
  1437. rejectPieceMessageInQueue.
  1438. (send): Removed.
  1439. (getMessage): New function.
  1440. (getMessageLength): New function.
  1441. * src/BitfieldMessage.h: Derived from SimplePeerMessage.
  1442. (msg): New variable.
  1443. (msgLength): New variable.
  1444. (~BitfieldMessage): Deleted msg.
  1445. (send): Removed.
  1446. (getMessage): New function.
  1447. (getMessageLength): New function.
  1448. * src/BitfieldMessage.cc
  1449. (create): New function.
  1450. (send): Removed.
  1451. (getMessage): New function.
  1452. (getMessageLength): New function.
  1453. * src/ChokeMessage.h: Derived from SimplePeerMessage.
  1454. (msg): New variable.
  1455. (sendPredicate): New function.
  1456. (onSendComplete): New function.
  1457. (send): Removed.
  1458. (getMessage): New function.
  1459. (getMessageLength): New function.
  1460. (create): New function.
  1461. * src/ChokeMessage.cc
  1462. (create): New function.
  1463. (send): Removed.
  1464. (sendPredicate): New function.
  1465. (getMessage): New function.
  1466. (getMessageLength): New function.
  1467. (onSendComplete): New function.
  1468. * src/KeepAliveMessage.h: Derived from SimplePeerMessage.
  1469. (msg): New variable.
  1470. (send): Removed.
  1471. (getMessage): New function.
  1472. (getMessageLength): New function.
  1473. * src/KeepAliveMessage.cc
  1474. (send): Removed.
  1475. (getMessage): New function.
  1476. (getMessageLength): New function.
  1477. * src/PortMessage.h
  1478. (create): New function.
  1479. (receivedAction): Updated log message.
  1480. * src/PortMessage.cc: New file.
  1481. * src/UnchokeMessage.h: Derived from SimplePeerMessage.
  1482. (msg): New variable.
  1483. (sendPredicate): New function.
  1484. (onSendComplete): New function.
  1485. (create): New function.
  1486. (send): Removed.
  1487. (getMessage): New function.
  1488. (getMessageLength): New function.
  1489. * src/UnchokeMessage.cc
  1490. (create): New function.
  1491. (send): Removed.
  1492. (sendPredicate): New function.
  1493. (getMessage): New function.
  1494. (getMessageLength): New function.
  1495. (onSendComplete): New function.
  1496. * src/PieceMessage.h
  1497. (leftPieceDataLength): Removed.
  1498. (leftDataLength): New variable.
  1499. (headerSend): New variable.
  1500. (pendingCount): New variable.
  1501. (msgHeader): New variable.
  1502. (sendPieceData): New function.
  1503. (incrementPendingCount): New function.
  1504. (isPendingCountMax): New function.
  1505. (create): New function.
  1506. (getMessageHeader): New function.
  1507. (getMessageHeaderLength): New function.
  1508. * src/PieceMessage.cc
  1509. (create): New function.
  1510. (getMessageHeader): New function.
  1511. (getMessageHeaderLength): New function.
  1512. (send): Rewritten.
  1513. (sendPieceData): New function.
  1514. * src/HaveMessage.h: Derived from SimplePeerMessage.
  1515. (msg): New variable.
  1516. (create): New function.
  1517. (getMessage): New function.
  1518. (getMessageLength): New function.
  1519. * src/HaveMessage.cc
  1520. (create): New function.
  1521. (send): Removed.
  1522. (sendPieceData): New function.
  1523. (getMessage): New function.
  1524. (getMessageLength): New function.
  1525. * src/RequestMessage.h: Derived from SimplePeerMessage.
  1526. (msg): New variable.
  1527. (create): New function.
  1528. (send): Removed.
  1529. (getMessage): New function.
  1530. (getMessageLength): New function.
  1531. * src/RequestMessage.cc
  1532. (create): New function.
  1533. (receivedAction): Added the handling of fast extension.
  1534. Deleted torrentMan->addUploadLength, torrentMan->addDeltaUploadLength.
  1535. (send): Removed.
  1536. (getMessage): New function.
  1537. (getMessageLength): New function.
  1538. * src/InterestedMessage.h: Derived from SimplePeerMessage.
  1539. (msg): New variable.
  1540. (sendPredicate): New function.
  1541. (onSendComplete): New function.
  1542. (create): New function.
  1543. (getMessage): New function.
  1544. (getMessageLength): New function.
  1545. * src/InterestedMessage.cc
  1546. (create): New function.
  1547. (send): Removed.
  1548. (sendPieceData): New function.
  1549. (getMessage): New function.
  1550. (getMessageLength): New function.
  1551. (onSendComplete): New function.
  1552. * src/NotInterestedMessage.h: Derived from SimplePeerMessage.
  1553. (msg): New variable.
  1554. (sendPieceData): New function.
  1555. (onSendComplete): New function.
  1556. (create): New function.
  1557. (send): Removed.
  1558. (getMessage): New function.
  1559. (getMessageLength): New function.
  1560. * src/NotInterestedMessage.cc
  1561. (create): New function.
  1562. (send): Removed.
  1563. (sendPredicate): New function.
  1564. (getMessage): New function.
  1565. (getMessageLength): New function.
  1566. (onSendComplete): New function.
  1567. * src/AllowedFastMessage.h: New class.
  1568. * src/AllowedFastMessage.cc: New class.
  1569. * src/RejectMessage.h: New class.
  1570. * src/RejectMessage.cc: New class.
  1571. * src/SuggestPieceMessage.h: New class.
  1572. * src/SuggestPieceMessage.cc: New class.
  1573. * src/HaveAllMessage.h: New class.
  1574. * src/HaveAllMessage.cc: New class.
  1575. * src/HaveNoneMessage.h: New class.
  1576. * src/HaveNoneMessage.cc: New class.
  1577. * src/HandshakeMessage.h: Derived from SimplePeerMessage.
  1578. (msg): New variable.
  1579. (reserved): New variable.
  1580. (create): New function.
  1581. (getId): New function.
  1582. (receivedAction): New function.
  1583. (getMessage): New function.
  1584. (getMessageLength): New function.
  1585. (isFastExtensionSupported): New function.
  1586. * src/HandshakeMessage.cc
  1587. (HandshakeMessage): Moved here from HandshakeMessage.h.
  1588. (create): New function.
  1589. (getMessage): New function.
  1590. (getMessageLength): New function.
  1591. (toString): Added the output of reserved field.
  1592. (check): Added const qualifier.
  1593. (isFastExtensionSupported): New function.
  1594. * src/PeerMessageUtil.h
  1595. (createChokeMessage): Removed.
  1596. (createUnchokeMessage): Removed.
  1597. (createInterestedMessage): Removed.
  1598. (createNotInterestedMessage): Removed.
  1599. (createHaveMessage): Removed.
  1600. (createBitfieldMessage): Removed.
  1601. (createRequestMessage): Removed.
  1602. (createCancelMessage): Removed.
  1603. (createPieceMessage): Removed.
  1604. (createPortMessage): Removed.
  1605. (createChokeMessage): Removed.
  1606. (createUnchokeMessage): Removed.
  1607. (createInterestedMessage): Removed.
  1608. (createNotInterestedMessage): Removed.
  1609. (createHaveMessage): Removed.
  1610. (createBitfieldMessage): Removed.
  1611. (createRequestMessage): Removed.
  1612. (createCancelMessage): Removed.
  1613. (createPieceMessage): Removed.
  1614. (createKeepAliveMessage): Removed.
  1615. (createHandshakeMessage): Removed.
  1616. (setIntParam): New function.
  1617. (createPeerMessageString): New function.
  1618. * src/PeerMessageUtil.cc
  1619. (createChokeMessage): Removed.
  1620. (createUnchokeMessage): Removed.
  1621. (createInterestedMessage): Removed.
  1622. (createNotInterestedMessage): Removed.
  1623. (createHaveMessage): Removed.
  1624. (createBitfieldMessage): Removed.
  1625. (createRequestMessage): Removed.
  1626. (createCancelMessage): Removed.
  1627. (createPieceMessage): Removed.
  1628. (createPortMessage): Removed.
  1629. (createRequestMessage): Removed.
  1630. (createCancelMessage): Removed.
  1631. (createPieceMessage): Removed.
  1632. (createHaveMessage): Removed.
  1633. (createChokeMessage): Removed.
  1634. (createUnchokeMessage): Removed.
  1635. (createInterestedMessage): Removed.
  1636. (createNotInterestedMessage): Removed.
  1637. (createBitfieldMessage): Removed.
  1638. (createKeepAliveMessage): Removed.
  1639. (createHandshakeMessage): Removed.
  1640. (setIntParam): New function.
  1641. (createPeerMessageString): New function.
  1642. * src/PeerConnection.h
  1643. (peer): Removed.
  1644. (torrentMan): Removed.
  1645. (createNLengthMessage): Removed.
  1646. (setIntParam): Removed.
  1647. (writeOutgoingMessageLog): Removed all overloaded functions.
  1648. (PeerConnection): Deleted peer and torrentMan from its arguments.
  1649. (sendMessage): New function.
  1650. (sendHandshake): Removed.
  1651. (sendKeepAlive): Removed.
  1652. (sendChoke): Removed.
  1653. (sendUnchoke): Removed.
  1654. (sendInterested): Removed.
  1655. (sendNotInterested): Removed.
  1656. (sendHave): Removed.
  1657. (sendBitfield): Removed.
  1658. (sendRequest): Removed.
  1659. (sendPiece): Removed.
  1660. (sendPieceHeader): Removed.
  1661. (sendPieceData): Removed.
  1662. (sendCancel): Removed.
  1663. (getPeer): Removed.
  1664. * src/PeerConnection.cc
  1665. (PeerConnection): Deleted peer and torrentMan from its arguments.
  1666. (sendHandshake): Removed.
  1667. (sendKeepAlive): Removed.
  1668. (createNLengthMessage): Removed.
  1669. (setIntParam): Removed.
  1670. (writeOutgoingMessageLog): Removed all overloaded functions.
  1671. (sendChoke): Removed.
  1672. (sendUnchoke): Removed.
  1673. (sendInterested): Removed.
  1674. (sendNotInterested): Removed.
  1675. (sendHave): Removed.
  1676. (sendBitfield): Removed.
  1677. (sendRequest): Removed.
  1678. (sendPiece): Removed.
  1679. (sendPieceHeader): Removed.
  1680. (sendPieceData): Removed.
  1681. (sendMessage): New function.
  1682. (sendCancel): Removed.
  1683. * src/PeerInteractionCommand.cc
  1684. (PeerInteractionCommand): Call setUploadLimit.
  1685. (executeInternal): Call setUploadLimit.
  1686. Added the handling of "inProgress" state of handshake message.
  1687. Call sendBitfield() or sendAllowdFast() instead of deprecated
  1688. sendNow().
  1689. (keepAlive): Call addMessage and sendMessage instead of deprecated
  1690. sendNow().
  1691. (beforeSocketCheck): Call addMessage instead of deprecated trySendNow()
  1692. * src/TorrentMan.h
  1693. (PEER_ID_LENGTH): New definition.
  1694. (hasAllPieces): New function.
  1695. * src/TorrentMan.cc
  1696. (getMissingPiece): Added the handling of fast extension.
  1697. (cancelPiece): Call updatePiece().
  1698. (hasAllPieces): New function.
  1699. * src/PeerInteraction.h
  1700. (fastSet): New variable.
  1701. (getNewPieceAndSendInterest): Changed the return type to void.
  1702. (send): Renamed as sendMessages.
  1703. (deleteAllRequestSlot): Removed.
  1704. (deleteRequestMessageInQueue): Renamed as rejectPieceMessageInQueue.
  1705. (cancelAllRequest): Removed all overloaded functions.
  1706. (deleteAllRequestSlot): Removed.
  1707. (deletePieceMessageInQueue): Renamed as rejectAllPieceMessageInQueue.
  1708. (rejectPieceMessageInQueue): New function.
  1709. (rejectAllPieceMessageInQueue): New function.
  1710. (onChoked): New function.
  1711. (isSendingMessageInProgress): New function.
  1712. (getCorrespondingRequestSlot): Changed its arguments.
  1713. (isInFastSet): New function.
  1714. (addFastSetIndex): New function.
  1715. (addRequests): New function.
  1716. (sendNow): Removed.
  1717. (trySendNow): Removed.
  1718. (sendBitfield): New function.
  1719. (sendAllowdFast): New function.
  1720. (createHaveAllMessage): New function.
  1721. (createHaveNoneMessage): New function.
  1722. (createRejectMessage): New function.
  1723. (createAllowedFastMessage): New function.
  1724. * src/PeerInteraction.cc
  1725. (send): Renamed as sendMessages.
  1726. (sendMessages): New function.
  1727. (MsgPushBack): New class.
  1728. (isSendingMessageInProgress): New function.
  1729. (deletePieceMessageInQueue): Renamed as rejectAllPieceMessageInQueue.
  1730. (rejectAllPieceMessageInQueue): New function.
  1731. Added the handling of fast extension.
  1732. (deleteRequestMessageInQueue): Renamed as rejectPieceMessageInQueue.
  1733. (rejectPieceMessageInQueue): New function.
  1734. Added the handling of fast extension.
  1735. (deleteRequestSlot): Replaced for loop with std::find.
  1736. (onChoked): New function.
  1737. (deleteAllRequestSlot): Removed.
  1738. (abortPiece): Rewirtten.
  1739. (deleteTimeoutRequestSlot): Updated log messages.
  1740. (getCorrespondingRequestSlot): Changed its arguments.
  1741. (cancelAllRequest): Removed all overloaded functions.
  1742. (receiveHandshake): Added the check to see whether an incoming peer
  1743. supports fast extension.
  1744. (createHandshakeMessage): Use HandshakeMessage::create instead of
  1745. PeerMessageUtil.
  1746. (createPeerMessage): Use create() of each message class instead of
  1747. PeerMessageUtil.
  1748. HaveAllMessage, HaveNoneMessage, RejectMessage, SuggestPieceMessage,
  1749. AllowedFastMessage were added.
  1750. (getNewPieceAndSendInterest): Changed its return value type to void.
  1751. Added the handling of fast extension.
  1752. (addRequests): New function.
  1753. (sendNow): Removed.
  1754. (sendHandshake): Rewritten.
  1755. (trySendNow): Removed.
  1756. (sendBitfield): New function.
  1757. (sendAllowdFast): New function.
  1758. (isInFastSet): New function.
  1759. (addFastSetIndex): New function.
  1760. (createRequestMessage): Use RequestMessage::create instead of
  1761. PeerMessageUtil.
  1762. (createCancelMessage): Use CancelMessage::create instead of
  1763. PeerMessageUtil.
  1764. (createPieceMessage): Use PieceMessage::create instead of
  1765. PeerMessageUtil.
  1766. (createHaveMessage): Use HaveMessage::create instead of
  1767. PeerMessageUtil.
  1768. (createChokeMessage): Use ChokeMessage::create instead of
  1769. PeerMessageUtil.
  1770. (createUnchokeMessage): Use UnchokeMessage::create instead of
  1771. PeerMessageUtil.
  1772. (createInterestedMessage): Use InterestedMessage::create instead of
  1773. PeerMessageUtil.
  1774. (createNotInterestedMessage): Use NotInterestedMessage::create instead
  1775. of PeerMessageUtil.
  1776. (createBitfieldMessage): Use BitfieldMessage::create instead of
  1777. PeerMessageUtil.
  1778. (createKeepAliveMessage): Use KeepAliveMessage::create instead of
  1779. PeerMessageUtil.
  1780. (createHaveAllMessage): New function.
  1781. (createHaveNoneMessage): New function.
  1782. (createRejectMessage): New function.
  1783. (createAllowedFastMessage: New function.
  1784. * src/Util.h
  1785. (sha1Sum): New function.
  1786. (computeFastSet): New function.
  1787. * src/Util.cc
  1788. (sha1Sum): New function.
  1789. (computeFastSet): New function.
  1790. * src/Peer.h
  1791. (fastExtensionEnabled): New variable.
  1792. (fastSet): New variable.
  1793. (setAllBitfield): New function.
  1794. (setFastExtensionEnabled): New function.
  1795. (isFastExtensionEnabled): New function.
  1796. (addFastSetIndex): New function.
  1797. (getFastSet): New function.
  1798. (isInFastSet): New function.
  1799. (countFastSet): New function.
  1800. * src/Peer.cc
  1801. (isInFastSet): New function.
  1802. (addFastSetIndex): New function.
  1803. (setAllBitfield): New function.
  1804. * src/AbstractCommand.cc (execute): Changed the procedure of checking
  1805. sockets.
  1806. * src/PeerAbstractCommand.cc
  1807. (PeerAbstractCommand): Added the initialization for uploadLimitCheck
  1808. and uploadLimit.
  1809. (execute): Changed the procedure of checking sockets. The upload speed
  1810. checking were added.
  1811. (setUploadLimit): New function.
  1812. (setUploadLimitCheck): New function.
  1813. * src/PeerAbstractCommand.h
  1814. (setUploadLimit): New function.
  1815. (setUploadLimitCheck): New function.
  1816. (uploadLimit): New variable.
  1817. (uploadLimitCheck): New variable.
  1818. To contact a tracker regularly:
  1819. * src/TrackerWatcherCommand.h (interval): New variable.
  1820. (checkPoint): New variable.
  1821. (TrackerWatcherCommand): Added interval argument.
  1822. * src/TrackerWatcherCommand.cc
  1823. (TrackerWatcherCommand): Initialized checkPoint.
  1824. (execute): Now a tracker is contacted in every specified period.
  1825. If peer list is not needed, send request with numwant=0.
  1826. * src/TrackerUpdateCommand.cc
  1827. (execute): Updated log messages.
  1828. * src/DownloadEngine.cc
  1829. (~DownloadEngine): Removed two asserts.
  1830. (waitData): Uncommented wfds. May be a bug fix.
  1831. 2006-05-10 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  1832. * src/PeerInteractionCommand.h
  1833. (checkInactiveConnection): Removed.
  1834. * src/PeerInteractionCommand.cc
  1835. (executeInternal): Removed following function calls:
  1836. detectMessageFlooding(), checkLongTimePeerChoking and
  1837. checkInactiveConnection().
  1838. (checkInactiveConnection): Removed.
  1839. (detectMessageFlooding): Removed function call to
  1840. checkInactiveConnection().
  1841. * src/PeerMessageUtil.h
  1842. (createChokeMessage): New function. Overload.
  1843. (createUnchokeMessage): New function. Overload.
  1844. (createInterestedMessage): New function. Overload.
  1845. (createNotInterestedMessage): New function. Overload.
  1846. (createHaveMessage): New function. Overload.
  1847. (createBitfieldMessage): New function. Overload.
  1848. (createRequestMessage): New function. Overload.
  1849. (createCancelMessage): New function. Overload.
  1850. (createPieceMessage): New function. Overload.
  1851. (createKeepAliveMessage): New function. Overload.
  1852. * src/PeerMessageUtil.cc
  1853. (createChokeMessage): New function. Overload.
  1854. (createUnchokeMessage): New function. Overload.
  1855. (createInterestedMessage): New function. Overload.
  1856. (createNotInterestedMessage): New function. Overload.
  1857. (createHaveMessage): New function. Overload.
  1858. (createBitfieldMessage): New function. Overload.
  1859. (createRequestMessage): New function. Overload.
  1860. (createCancelMessage): New function. Overload.
  1861. (createPieceMessage): New function. Overload.
  1862. (createKeepAliveMessage): New function. Overload.
  1863. * src/SendMessageQueue.cc
  1864. (createRequestMessage): Use PeerMessageUtil.
  1865. (createCancelMessage): Use PeerMessageUtil.
  1866. (createPieceMessage): Use PeerMessageUtil.
  1867. (createHaveMessage): Use PeerMessageUtil.
  1868. (createChokeMessage): Use PeerMessageUtil.
  1869. (createUnchokeMessage): Use PeerMessageUtil.
  1870. (createInterestedMessage): Use PeerMessageUtil.
  1871. (createNotInterestedMessage): Use PeerMessageUtil.
  1872. (createBitfieldMessage): Use PeerMessageUtil.
  1873. (createKeepAliveMessage): Use PeerMessageUtil.
  1874. * src/SendMessageQueue.h: Renamed to PeerInteraction.h
  1875. * src/SendMessageQueue.cc: Renamed to PeerInteraction.cc
  1876. * src/PeerInteraction.h: New class.
  1877. * src/PeerInteraction.cc: New class.
  1878. 2006-05-09 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  1879. Each peer message has its own class.
  1880. * src/PendingMessages.h: Removed.
  1881. * src/PendingMessages.cc: Removed. The sending process was moved to
  1882. each message class.
  1883. * src/RequestSlotMan.h: Removed.
  1884. * src/RequestSlotMan.cc: Removed. All functionarities were moved to
  1885. SendMessageQueue.
  1886. * src/RequestMessage.h: New class.
  1887. * src/RequestMessage.cc: New class.
  1888. * src/CancelMessage.h: New class.
  1889. * src/CancelMessage.cc: New class.
  1890. * src/BitfieldMessage.h: New class.
  1891. * src/BitfieldMessage.cc: New class.
  1892. * src/ChokeMessage.h: New class.
  1893. * src/ChokeMessage.cc: New class.
  1894. * src/KeepAliveMessage.h: New class.
  1895. * src/KeepAliveMessage.cc: New class.
  1896. * src/PortMessage.h: New class.
  1897. * src/UnchokeMessage.h: New class.
  1898. * src/UnchokeMessage.cc: New class.
  1899. * src/PieceMessage.h: New class.
  1900. * src/PieceMessage.cc: New class.
  1901. * src/HaveMessage.h: New class.
  1902. * src/HaveMessage.cc: New class.
  1903. * src/BitfieldMessage.h: New class.
  1904. * src/BitfieldMessage.cc: New class.
  1905. * src/NotInterestedMessage.h: New class.
  1906. * src/NotInterestedMessage.cc: New class.
  1907. * src/InterestedMessage.h: New class.
  1908. * src/InterestedMessage.cc: New class.
  1909. * src/HandshakeMessage.h (sendMessageQueue): New variable.
  1910. (getSendMessageQueue): New function.
  1911. (setSendMessageQueue): New function.
  1912. * src/HandshakeMessage.cc: New class.
  1913. * src/PeerConnection.h (receiveMessage): Changed return value and
  1914. arguments.
  1915. (receiveHandshake): Changed return value and arguments.
  1916. * src/PeerConnection.cc (receiveMessage): Do not create message class
  1917. here.
  1918. (receiveHandshake): Do not create handshake class here.
  1919. * src/PeerInteractionCommand.h (peerConnection): Removed.
  1920. (piece): Removed.
  1921. (syncPiece): Removed.
  1922. (sendInterest): Removed.
  1923. (sendMessages): Removed.
  1924. (createRequestPendingMessage): Removed.
  1925. (checkPieceHash): Removed.
  1926. (erasePieceOnDisk): Removed.
  1927. (getNewPieceAndSendInterest): Removed.
  1928. (onGotNewPice): Removed.
  1929. (onGotWrongPiece): Removed.
  1930. * src/PeerInteractionCommand.cc (PeerInteractionCommand):
  1931. Removed peerConnection, piece.
  1932. (~PeerInteractionCommand): Removed peerConnection.
  1933. (executeInternal): Use sendMessageQueue instead of peerConnection.
  1934. (syncPiece): Moved to SendMessageQueue.
  1935. (decideChoking): Removed PendingMessage.
  1936. (receiveMessage): Use sendMessageQueue instead of peerConnection.
  1937. The action after receiving peer message was moved to each message
  1938. class.
  1939. (onGotNewPice): Moved to SendMessageQueue.
  1940. (onGotWrongPiece): Moved to SendMessageQueue.
  1941. (getNewPieceAndSendInterest): Moved to SendMessageQueue.
  1942. (sendInterest): Moved to SendMessageQueue.
  1943. (createRequestPendingMessage): Removed.
  1944. (sendMessages): Moved to SendMessageQueue.
  1945. (onAbort): Use SendMessageQueue::abortPiece()
  1946. (keepAlive): Use sendMessageQueue instead of peerConnection.
  1947. (beforeSocketCheck): Use sendMessageQueue instead of peerConnection.
  1948. (checkPieceHash): Moved to SendMessageQueue.
  1949. (erasePieceOnDisk): Moved to SendMessageQueue.
  1950. * src/PeerMessageUtil.h
  1951. (createBitfieldMessage): Removed.
  1952. (createHaveMessage): Changed return value and arguments.
  1953. (createBitfieldMessage): Changed return value and arguments.
  1954. (createRequestCancelMessage): Removed.
  1955. (createPieceMessage): Changed return value and arguments.
  1956. (getShortIntParam): New function.
  1957. (checkIndex): Changed arguments.
  1958. (checkBegin): Changed arguments.
  1959. (checkLength): Changed arguments.
  1960. (checkPieceOffset): Removed.
  1961. (checkRange): New function.
  1962. (checkBitfield): Changed arguments.
  1963. (createPeerMessage): Removed.
  1964. (checkIntegrity): Removed.
  1965. (createHandshakeMessage): Changed arguments.
  1966. (createChokeMessage): New function.
  1967. (createUnchokeMessage): New function.
  1968. (createInterestedMessage): New function.
  1969. (createNotInterestedMessage): New function.
  1970. (createRequestMessage): New function.
  1971. (createCancelMessage): New function.
  1972. (createPortMessage): New function.
  1973. * src/PeerMessageUtil.cc
  1974. (createBitfieldMessage): Removed.
  1975. (createHaveMessage): Changed return value and arguments.
  1976. (createBitfieldMessage): Changed return value and arguments.
  1977. (createRequestCancelMessage): Removed.
  1978. (createPieceMessage): Changed return value and arguments.
  1979. (getShortIntParam): New function.
  1980. (checkIndex): Changed arguments.
  1981. (checkBegin): Changed arguments.
  1982. (checkLength): Changed arguments.
  1983. (checkPieceOffset): Removed.
  1984. (checkRange): New function.
  1985. (checkBitfield): Changed arguments.
  1986. (createPeerMessage): Removed.
  1987. (checkIntegrity): Removed.
  1988. (createHandshakeMessage): Changed arguments.
  1989. (createChokeMessage): New function.
  1990. (createUnchokeMessage): New function.
  1991. (createInterestedMessage): New function.
  1992. (createNotInterestedMessage): New function.
  1993. (createRequestMessage): New function.
  1994. (createCancelMessage): New function.
  1995. (createPortMessage): New function.
  1996. * src/PeerMessage.h
  1997. (id): Removed.
  1998. (index): Removed.
  1999. (begin): Removed.
  2000. (length): Removed.
  2001. (bitfield): Removed.
  2002. (bitfieldLength): Removed.
  2003. (block): Removed.
  2004. (blockLength): Removed.
  2005. (inProgress): New variable.
  2006. (cuid): New variable.
  2007. (peer): New variable.
  2008. (sendMessageQueue): New variable.
  2009. (logger): New variable.
  2010. (setBitfield): Removed.
  2011. (getBitfield): Removed.
  2012. (setBlock): Removed.
  2013. (getBlock): Removed.
  2014. (getBitfieldLength): Removed.
  2015. (getBlockLength): Removed.
  2016. (isInProgress): New function.
  2017. (toString): Made pure virtual.
  2018. (check): New function.
  2019. (send): New function.
  2020. (receivedAction): New function.
  2021. (getId): Made pure virtual.
  2022. (setId): Removed.
  2023. (getIndex): Removed.
  2024. (setIndex): Removed.
  2025. (getBegin): Removed.
  2026. (setBegin): Removed.
  2027. (getLength): Removed.
  2028. (setLength): Removed.
  2029. (getCuid): New function.
  2030. (setCuid): New function.
  2031. (getPeer): New function.
  2032. (setPeer): New function.
  2033. (getSendMessageQueue): New function.
  2034. (setSendMessageQueue): New function.
  2035. (ID): Removed.
  2036. * src/PeerMessage.cc
  2037. (setBitfield): Removed.
  2038. (setBlock): Removed.
  2039. (toString): Removed.
  2040. * src/TorrentMan.h
  2041. (getPieceLength): New function.
  2042. (getPieceLength): New function.
  2043. * src/SendMessageQueue.h
  2044. (REQUEST_TIME_OUT): New definition.
  2045. (RequestSlots): New definition.
  2046. (MessageQueue): New definition.
  2047. (requestSlotMan): Removed.
  2048. (pendingMessages): Removed.
  2049. (requestSlots): New variable.
  2050. (messageQueue): New variable.
  2051. (torrentMan): New variable.
  2052. (peerConnection): New variable.
  2053. (peer): New variable.
  2054. (piece): New variable.
  2055. (getNewPieceAndSendInterest): New function.
  2056. (createPeerMessage): New function.
  2057. (createHandshakeMessage): New function.
  2058. (send): Made private.
  2059. (setPeerMessageCommonProperty): New function.
  2060. (deleteAllRequestSlot): New function.
  2061. (deleteRequestMessageInQueue): New function.
  2062. (cancelAllRequest): Made private.
  2063. (cancelAllRequest): Made private.
  2064. (countRequestSlot): Made private.
  2065. (addPendingMessage): Removed.
  2066. (deletePendingPieceMessage): Removed.
  2067. (deletePendingRequestMessage): Removed.
  2068. (addMessage): New function.
  2069. (deletePieceMessageInQueue): New function.
  2070. (deleteTimeoutRequestSlot): Changed argument.
  2071. (deleteCompletedRequestSlot): Changed argument.
  2072. (getCorrespoindingRequestSlot): Renamed to getCorrespondingRequestSlot.
  2073. (getCorrespondingRequestSlot): New function.
  2074. (countPendingMessage): Removed.
  2075. (countMessageInQueue): New function.
  2076. (getTorrentMan): New function.
  2077. (getPeerConnection): New function.
  2078. (hasDownloadPiece): New function.
  2079. (getDownloadPiece): New function.
  2080. (setDownloadPiece): New function.
  2081. (syncPiece): New function.
  2082. (sendMessages): New function.
  2083. (sendNow): New function.
  2084. (trySendNow): New function.
  2085. (abortPiece): New function.
  2086. (sendHandshake): New function.
  2087. (receiveMessage): New function.
  2088. (receiveHandshake): New function.
  2089. (createRequestMessage): New function.
  2090. (createCancelMessage): New function.
  2091. (createPieceMessage): New function.
  2092. (createHaveMessage): New function.
  2093. (createChokeMessage): New function.
  2094. (createUnchokeMessage): New function.
  2095. (createInterestedMessage): New function.
  2096. (createNotInterestedMessage): New function.
  2097. (createBitfieldMessage): New function.
  2098. (createKeepAliveMessage): New function.
  2099. * src/SendMessageQueue.cc
  2100. (SendMessageQueue): Removed requestSlotMan.
  2101. Instantiated peerConnection here.
  2102. (~SendMessageQueue): Removed requestSlotMan.
  2103. Added deletion of peerConnection and the contents of messageQueue.
  2104. (send): Updated according to the change of messageQueue.
  2105. (addPendingMessage): Renamed to addMessage.
  2106. (addMessage): New function.
  2107. (deletePendingPieceMessage): Renamed to deletePieceMessageInQueue.
  2108. (deletePieceMessageInQueue): New function.
  2109. (deletePendingRequestMessage): Renamed to deleteRequestMessageInQueue.
  2110. (deleteRequestMessageInQueue): New function.
  2111. (deleteRequestSlot): RequestSlotMan::deleteRequestSlot(...) was moved
  2112. here.
  2113. (deleteTimeoutRequestSlot): RequestSlotMan::deleteTimeoutRequestSlot
  2114. (...) was moved here.
  2115. (deleteAllRequestSlot): RequestSlotMan::deleteAllRequestSlot(...) was
  2116. moved here.
  2117. (deleteCompletedRequestSlot):
  2118. RequestSlotMan::deleteCompletedRequestSlot(...) was moved here.
  2119. (getCorrespondingRequestSlot):
  2120. RequestSlotMan::getCorrespoindingRequestSlot(...) was moved here.
  2121. And renamed to getCorrespondingRequestSlot, correcting a typo.
  2122. (countPendingMessage): Renamed to countMessageInQueue.
  2123. (countMessageInQueue): New function.
  2124. (countRequestSlot): RequestSlotMan::countRequestSlot() was moved here.
  2125. (receiveHandshake): New function.
  2126. (createHandshakeMessage): New function.
  2127. (receiveMessage): New function.
  2128. (createPeerMessage): New function.
  2129. (syncPiece): New function.
  2130. (getNewPieceAndSendInterest): New function.
  2131. (sendMessages): New function.
  2132. (sendNow): New function.
  2133. (trySendNow): New function.
  2134. (sendHandshake): New function.
  2135. (abortPiece): New function.
  2136. (getDownloadPiece): New function.
  2137. (getPeerMessageCommonProperty): New function.
  2138. (createRequestMessage): New function.
  2139. (createCancelMessage): New function.
  2140. (createPieceMessage): New function.
  2141. (createHaveMessage): New function.
  2142. (createChokeMessage): New function.
  2143. (createUnchokeMessage): New function.
  2144. (createInterestedMessage): New function.
  2145. (createNotInterestedMessage): New function.
  2146. (createBitfieldMessage): New function.
  2147. (createKeepAliveMessage): New function.
  2148. To add simple Content-Disposition support:
  2149. * src/HttpResponseCommand.h (determinFilename): New function.
  2150. * src/HttpResponseCommand.cc (executeInternal):
  2151. Use determinFilename(headers) instead of req->getFile() when comparing
  2152. filename.
  2153. (determinFilename): New function.
  2154. (handleDefaultEncoding): Use determinFilename(headers) instead of
  2155. req->getFile().
  2156. (handleOtherEncoding): Use determinFilename(headers) instead of
  2157. req->getFile().
  2158. * src/Util.h (getContentDispositionFilename): New function.
  2159. * src/Util.cc (getContentDispositionFilename): New function.
  2160. * src/LogFactory.h (release): New function.
  2161. * src/LogFactory.cc (release): New function.
  2162. To fix a bug that causes out-of-bound exception when HTTP status
  2163. line is wrong:
  2164. * src/HttpConnection.cc (receiveResponse): Added a check for header
  2165. size.
  2166. * src/common.h (Deleter): New class.
  2167. * src/SegmentMan.cc
  2168. (~SegmentMan): Added deletion of splitter and diskWriter.
  2169. * src/DownloadEngine.h
  2170. (Commands): Use deque.
  2171. (clearQueue): New function.
  2172. * src/DownloadEngine.cc
  2173. (~DownloadEngine): Added deletion of segmentMan.
  2174. (cleanQueue): New function.
  2175. * src/TorrentDownloadEngine.h
  2176. (TorrentDownloadEngine): The implementation was moved to
  2177. TorrentDownloadEngine.cc.
  2178. (~TorrentDownloadEngine): The implementation was moved to
  2179. TorrentDownloadEngine.cc.
  2180. * src/TorrentDownloadEngine.cc
  2181. (~TorrentDownloadEngine): Added deletion of torrentMan.
  2182. * src/main.cc
  2183. (clearRequest): Removed.
  2184. (handler): Added deletion of e.
  2185. (torrentHandler): Added deletion of te.
  2186. (main): Do not share splitter.
  2187. Use Deleter instead of clearRequest.
  2188. Deletion of classes were updated.
  2189. 2006-05-06 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2190. * src/main.cc (main): Fixed typo.
  2191. * src/message.h: Fixed typo.
  2192. * po/de.po: Added German translation, thanks to Hermann J. Beckers.
  2193. 2006-04-29 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2194. To add --select-file command-line option:
  2195. * src/Util.cc
  2196. (unfoldRange): New function.
  2197. (getNum): New function.
  2198. (unfoldSubRange): New function
  2199. * src/main.cc
  2200. (showUsage): Added help message.
  2201. (main): Added --select-file command-line option. Updated the layout of
  2202. file listing.
  2203. * src/common.h
  2204. (Integers): New definition.
  2205. * src/SocketCore.cc
  2206. (writeData): Removed timeout argument.
  2207. (readData): Removed timeout argument.
  2208. (peekData): Removed timeout argument.
  2209. * src/Socket.cc
  2210. (writeData): Removed timeout argument.
  2211. (readData): Removed timeout argument.
  2212. (peekData): Removed timeout argument.
  2213. * Release 0.4.1
  2214. 2006-04-28 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2215. To deploy upload rate based choking algorithm:
  2216. * src/PeerInteractionCommand.cc
  2217. (PeerInteractionCommand): Add peer to TorrentMan::activePeers to track
  2218. peer currently used.
  2219. (decideChoking): Deleted the choke/unchoke decision algorithm when
  2220. download completes. Simplified.
  2221. (receiveMessage): Updated.
  2222. * src/TorrentMan.h
  2223. (activePeers): New variable.
  2224. (addActivePeer): New function.
  2225. (getActivePeers): New function.
  2226. (deleteActivePeer): New function.
  2227. * src/TorrentMan.cc
  2228. (addPeer): deleteOldErrorPeers is moved to the begining of the function
  2229. * src/PeerAbstractCommand.cc
  2230. (onAbort): Use peer->resetStatus().
  2231. * src/main.cc
  2232. (PeerChokeCommand.h): Included.
  2233. (main): Added the instance of ChokingCommand to the command queue.
  2234. * src/Peer.h
  2235. (amChoking): Renamed from amChocking
  2236. (chokingRequired): New variable.
  2237. (optUnchoking): New variable.
  2238. (deltaUpload): New variable.
  2239. (deltaDownload): New variable.
  2240. (addDeltaUpload): New function.
  2241. (resetDeltaUpload): New function.
  2242. (addDeltaDownload): New function.
  2243. (resetDeltaDownload): New function.
  2244. (addPeerUpload): Added a call to addDeltaUpload.
  2245. (addPeerDownload): Added a call to addDeltaDownload.
  2246. * src/Peer.cc
  2247. (shouldBeChoking): Renamed from shouldChoke.
  2248. (resetStatus): New function.
  2249. * src/PeerChokeCommand.h: New class.
  2250. * src/PeerChokeCommand.cc: New class.
  2251. To add lazy upload speed limiter:
  2252. * src/TorrentConsoleDownloadEngine.h: Moved the variables for
  2253. statistics calculation to TorrentDownloadEngine.
  2254. * src/TorrentConsoleDownloadEngine.cc
  2255. (sendStatistics): Renamed from printStatistics.
  2256. (initStatistics): Removed. Moved to TorrentDownloadEngine.
  2257. (calculateSpeed): Removed. Moved to TorrentDownloadEngine.
  2258. (calculateStatistics): Removed. Moved to TorrentDownloadEngine.
  2259. * src/TorrentDownloadEngine.h: Added the variables for statistics
  2260. calculation.
  2261. (sendStatistics): New function as pure virtual function.
  2262. (getUploadSpeed): New function.
  2263. * src/TorrentDownloadEngine.cc
  2264. (initStatistics): New function.
  2265. (calculateSpeed): New function.
  2266. (calculateStatistics): New function.
  2267. * src/SendMessageQueue.h
  2268. (uploadLength): New variable.
  2269. (send): Added an argument.
  2270. (setUploadLimit): New function.
  2271. (getUploadLimit): New function.
  2272. * src/SendMessageQueue.cc
  2273. (send): Added upload speed limiter.
  2274. * src/prefs.h
  2275. (PREF_UPLOAD_LIMIT): New definition.
  2276. * src/PeerInteractionCommand.cc
  2277. (PeerInteractionCommand): Set upload speed limit to sendMessageQueue.
  2278. * src/main.cc
  2279. (main): Added --upload-limit option
  2280. For bug fixes:
  2281. * src/main.cc
  2282. (showUsage): Corrected --listen-port help
  2283. Other changes:
  2284. * src/TorrentMan.cc
  2285. (getPeer): Return nullPeer if connection is grather than
  2286. MAX_PEER_UPDATE(15) in order to leave space for incoming peers.
  2287. 2006-04-21 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2288. To add some useful information to the exception message:
  2289. * src/SocketCore.cc : Updated messages.
  2290. * src/SegmentMan.cc :
  2291. * src/TorrentMan.cc : Updated messages.
  2292. * src/MultiDiskWriter.cc : Updated messages.
  2293. * src/Util.cc : Updated messages.
  2294. * src/AbstractDiskWriter.cc : Updated messages.
  2295. * src/PreAllocationDiskWriter.cc : Updated messages.
  2296. * src/message.cc : Added new messages. Updated some messages.
  2297. * src/TrackerWatcherCommand.h (MIN_PEERS): New definition.
  2298. * src/TrackerWatcherCommand.cc (execute): Use MIN_PEERS.
  2299. Updated threshold from 30 to 15.
  2300. * src/AbstractDiskWriter.h (filename): New variable.
  2301. * src/AbstractDiskWriter.cc (openExistingFile): Assigned filename.
  2302. (createFile): Assigned filename.
  2303. * src/main.cc: Updated the help message for http-auth-scheme.
  2304. * Release 0.4.0
  2305. 2006-04-20 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2306. To add TrackerUpdateCommand with which replaces
  2307. CompactTrackerResponseProcessor:
  2308. * src/TrackerWatcherCommand.h (req): Removed.
  2309. * src/TrackerWatcherCommand.cc (execute): Send a request to tracker
  2310. if the number of peer connections are less than 30.
  2311. * src/ByteArrayDiskWriter.h (readData): Implemented.
  2312. * src/SegmentMan.h (diskWriter): New function.
  2313. * src/SegmentMan.cc (init): Added a call to diskWriter->closeFile()
  2314. * src/main.cc : Removed #include "CompactTrackerResponseProcessor.h"
  2315. (main): Use TrackerUpdateCommand.
  2316. * src/TorrentMan.h (CompactTrackerResponseProcessor): Removed.
  2317. (req): New variable.
  2318. (setTrackerResponseProcessor): Removed.
  2319. (getTrackerResponseProcessor): Removed.
  2320. (processTrackerResponse): Removed.
  2321. * src/DownloadEngine.h (diskWriter): Removed.
  2322. * src/TorrentDownloadEngine.cc (afterEachIteration): Removed a call
  2323. to torrentMan->processTrackerResponse().
  2324. To add Util::expandBuffer:
  2325. * src/ByteArrayDiskWriter.h (expandBuffer): Removed.
  2326. * src/ByteArrayDiskWriter.cc (writeData): Use Util::expandBuffer().
  2327. * src/Util.h (expandBuffer): New function.
  2328. To fix the bug that causes segmentation fault when "-l ." is specified
  2329. in command-line option:
  2330. * src/SimpleLogger.h (SimpleLogger): Removed "filename" argument.
  2331. (openFile): New function.
  2332. (closeFile): New function.
  2333. * src/SimpleLogger.cc (SimpleLogger): Removed fopen.
  2334. (~SimpleLogger): Call closeFile();
  2335. * src/LogFactory.cc (getInstance): Added a call to slogger->openFile().
  2336. * src/main.cc (main): Added a check to see logger is configured
  2337. properly.
  2338. To enable HTTP authentication without specifying "--http-auth-scheme"
  2339. * src/prefs.h (PREF_HTTP_AUTH_ENABLED): New definition.
  2340. * src/HttpConnection.cc (createRequest): Send Authorization header
  2341. if PREF_HTTP_AUTH_ENABLED == V_TRUE.
  2342. * src/main.cc (main): Preset PREF_HTTP_AUTH_SCHEME to V_TRUE
  2343. If "--http-user" is specified, set PREF_HTTP_AUTH_ENABLED to V_TRUE
  2344. * src/Peer.cc (shouldChoke): Updated algorithm.
  2345. * src/message.h (EX_AUTH_FAILED): New definition.
  2346. (EX_FILE_OPEN): New definition.
  2347. * src/HttpResponseCommand.cc (checkResponse): Throw DlAbortEx
  2348. if status == 401.
  2349. (handleDefaultEncoding): Added a call to diskWriter->initAndOpenFile()
  2350. if req->isTorrent == true.
  2351. * src/main.cc (handler): Removed the check to see e->diskWriter != NULL
  2352. (torrentHandler): Removed the check to see diskAdaptor != NULL.
  2353. * src/AbstractDiskWriter.cc (openExistingFile): Updated messsage.
  2354. (createFile): Updated message.
  2355. 2006-04-19 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2356. To add a readout of estimated remaining time to normal HTTP/FTP
  2357. downloads:
  2358. * src/ConsoleDownloadEngine.h (startup): New variable.
  2359. (startupLength): New variable.
  2360. (isStartupLengthSet): New variable.
  2361. (avgSpeed): New variable.
  2362. (eta): New variable.
  2363. * src/ConsoleDownloadEngine.cc (sendStatistics): Added a readout of
  2364. estimated remaining time.
  2365. (initStatistics): Initialized newly added variables.
  2366. (calculateStatistics): Calculate average speed and estimated remaining
  2367. time.
  2368. To decouple TorrentDownloadEngine from HttpResponseCommand:
  2369. * src/TrackerDownloadCommand.h: Removed.
  2370. * src/TrackerDownloadCommand.cc: Removed.
  2371. * src/TrackerInitCommand.h: Removed.
  2372. * src/TrackerInitCommand.cc: Removed.
  2373. * src/TrackerUpdateCommand.h: Removed.
  2374. * src/TrackerUpdateCommand.cc: Removed.
  2375. * src/TrackerWatcherCommand.cc (execute): The construction of request
  2376. url written in TrackerInitCommand was moved here. Do not create
  2377. tracker request command if torrentMan->trackers != 0.
  2378. * src/CompactTrackerResponseProcessor.h: New class.
  2379. * src/CompactTrackerResponseProcessor.cc: New class.
  2380. * src/message.h (MSG_TRACKER_WARNING_MESSAGE): Updated.
  2381. * src/HttpResponseCommand.cc (createHttpDownloadCommand):
  2382. Decoupled TorrentDownloadEngine from this.
  2383. * src/SegmentMan.h (init): New function.
  2384. * src/SegmentMan.cc (init): New function.
  2385. * src/TorrentMan.h (responseProcessor): New variable.
  2386. (trackers): New variable.
  2387. (setTrackerResponseProcessor): New function.
  2388. (getTrackerResponseProcessor): New function.
  2389. (processTrackerResponse): New function.
  2390. * src/TorrentMan.cc (Constructor): Initialized new variable trackers.
  2391. (processTrackerResponse): New function.
  2392. * src/main.cc (main): Use ByteArrayDiskWriter and
  2393. CompactTrackerResponseProcessor.
  2394. * src/TorrentDownloadEngine.cc (afterEachIteration): Call torrentMan->
  2395. processTrackerResponse().
  2396. * src/TorrentConsoleDownloadEngine.cc (printStatistics): Updated a
  2397. readout.
  2398. * src/TorrentDownloadEngine.cc (afterEachIteration): Added log message
  2399. which indicates download has completed.
  2400. * src/AbstractDiskWriter.cc (Destructor): fd >= 0, not fd >0
  2401. (closeFile): fd >= 0, not fd > 0
  2402. * src/main.cc (main): Added short cut for show-files.
  2403. Added short cut for torrent-file.
  2404. Added new command-line option listen-port.
  2405. Updated i18n messages.
  2406. 2006-04-18 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2407. To add LogFactory which creates singleton logger:
  2408. * src/LogFactory.h: New class.
  2409. * src/LogFactory.cc: New class.
  2410. * src/Command.h (logger): New variable.
  2411. (Constructor): Use LogFactory.
  2412. * src/AbstractCommand.cc: Use Command::logger
  2413. * src/PeerConnection.cc (Constructor): Deleted the argument logger.
  2414. Use LogFactory.
  2415. * src/SegmentSplitter.h : Made logger protected.
  2416. * src/SegmentSplitter.cc (Constructor): Use LogFactory.
  2417. * src/SegmentMan.cc (Constructor): Use LogFactory.
  2418. * src/DownloadEngine.h : Made logger protected.
  2419. * src/DownloadEngine.cc (Constructor): Use LogFactory.
  2420. * src/PeerInteractionCommand.cc : Use Command::logger.
  2421. * src/HttpResponseCommand.cc : Use Command::logger.
  2422. * src/SegmentMan.h : Made logger private.
  2423. * src/TorrentMan.h : Made logger private.
  2424. * src/TorrentMan.cc : Use LogFactory.
  2425. * src/FtpNegotiateCommand.cc : Use Command::logger.
  2426. * src/HttpConnection.h (Constructor): Deleted the argument logger.
  2427. * src/HttpConnection.cc (Constructor): Deleted the argument logger.
  2428. Use LogFactory.
  2429. * src/FtpConnection.h (Constructor): Deleted the argument logger.
  2430. * src/FtpConnection.cc (Constructor): Deleted the argument logger.
  2431. Use LogFactory.
  2432. * src/DownloadCommand.cc : Use Command::logger.
  2433. * src/PeerAbstractCommand.cc : Use Command::logger.
  2434. * src/PeerListenCommand.cc : Use Command::logger.
  2435. * src/PeerInitiateConnectionCommand.cc : Use Command::logger.
  2436. * src/HttpInitiateConnectionCommand.cc : Use Command::logger.
  2437. * src/FtpInitiateConnectionCommand.cc : Use Command::logger.
  2438. * src/TrackerWatcherCommand.cc : Use Command::logger.
  2439. * src/TrackerUpdateCommand.cc : Use Command::logger.
  2440. * src/TrackerDownloadCommand.cc : Use Command::logger.
  2441. * src/RequestSlotMan.cc (Constructor): Deleted the argument logger.
  2442. Use LogFactory.
  2443. * src/SendMessageQueue.h (Constructor): Deleted the argument logger.
  2444. * src/SendMessageQueue.cc (Constructor): Deleted the argument logger.
  2445. Use LogFactory.
  2446. * src/main.cc (main): Use LogFactory.
  2447. * src/DiskAdaptor.h (logger): New variable.
  2448. * src/DiskAdaptor.cc (Constructor): Use LogFactory.
  2449. * src/CopyDiskAdaptor.cc (fixFilename): Added a log message.
  2450. 2006-04-17 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2451. * src/TrackerInitCommand.cc (TrackerInitCommand): Added a "key"
  2452. parameter to a tracker request.
  2453. * src/TorrentMan.cc (readFileEntryFromMetaInfoFile): Bug fix.
  2454. * src/TrackerWatcherCommand.cc (execute): Call req->resetTryCount().
  2455. * src/main.cc (setSignalHander): New function.
  2456. (main): Added a handler for SIGTERM.
  2457. (handler): Updated message.
  2458. (torrentHandler): Updated message.
  2459. 2006-04-16 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2460. * src/TorrentConsoleDownloadEngine.cc
  2461. (onPartialDownloadingCompletes): Renamed as
  2462. onSelectiveDownloadingCompletes.
  2463. (onSelectiveDownloadingCompletes): Updated message.
  2464. To add DiskAdaptor which abstract DiskWriter family:
  2465. * src/PeerConnection.cc: Use diskAdaptor instead of diskWriter.
  2466. * src/PeerInteractionCommand.cc: Use diskAdaptor instead of diskWriter.
  2467. * src/BitfieldMan.cc (isAllBitSet): bug fix.
  2468. * src/TorrentMan.cc : Included CopyDiskAdaptor.h, DirectDiskAdaptor.h,
  2469. MultiDiskAdaptor.h.
  2470. (readFileEntry): Changed its arguments.
  2471. (setup): setupDiskWriter is merged into this function.
  2472. (setupDiskWriter): Removed.
  2473. (setFileFilter): New function.
  2474. (readFileEntryFromMetaInfoFile): Updated according to the changes
  2475. made in readFileEntry.
  2476. (getFilePath): Removed.
  2477. (getTempFilePath): Removed.
  2478. (getSegmentFilePath): Updated due to the removal of getFilePath.
  2479. (fixFilename): Removed.
  2480. (copySingleFile): Removed.
  2481. (splitMultiFile): Removed.
  2482. (deleteTempFile): Removed.
  2483. (setFileEntriesToDownload): Removed.
  2484. (isPartialDownloadingMode): Renamed as isSelectiveDownloadingMode.
  2485. (isSelectiveDownloadingMode): New function.
  2486. (setAllMultiFileRequestedState): Removed.
  2487. (finishPartialDownloadingMode): Renamed as
  2488. finishSelectiveDownloadingMode.
  2489. (finishSelectiveDownloadingMode): New function.
  2490. (getPartialTotalLength): Renamed as getSelectedTotalLength.
  2491. (getSelectedTotalLength): New function.
  2492. (onDownloadComplete): Use diskAdaptor.
  2493. * src/MultiDiskWriter.cc (Constructor): Added the argument pieceLength
  2494. (Range): Removed.
  2495. (setMultiFileEntries): Renamed as setFileEntries.
  2496. (setFileEntries): New function.
  2497. * src/MultiDiskWriter.h [DiskWriterEntry](enabled): Removed.
  2498. (pieceLength): New variable.
  2499. * src/main.cc (printDownloadCompeleteMessage): New function.
  2500. (torrentHandler): Use diskAdaptor instead of diskWriter.
  2501. (main): Renamed torrent-show-files to show-files.
  2502. Rewritten file contents listing.
  2503. * src/TorrentMan.h (FileEntry): Removed.
  2504. (multiFileTopDir): Removed.
  2505. (multiFileEntries): Removed.
  2506. (diskWriter): Removed.
  2507. (diskAdaptor): New variable.
  2508. * src/DefaultDiskWriter.h (totalLength): New variable.
  2509. * src/DefaultDiskWriter.cc (initAndOpenFile): Added ftruncate.
  2510. * src/TorrentDownloadEngine.cc (onEndOfRun): Use diskAdaptor instead of
  2511. diskWriter.
  2512. * src/TorrentConsoleDownloadEngine.h
  2513. (partialDownloadLengthDiff): Renamed as selectedDownloadLengthDiff.
  2514. (partialTotalLength): Renamed as selectedTotalLength.
  2515. * src/AbstractDiskWriter.cc (openFile): If file exists, call
  2516. openExistingFile, otherwise call initAndOpenFile.
  2517. (closeFile): fd > 0, not fd != 0.
  2518. * src/DirectDiskAdaptor.h: New class.
  2519. * src/DirectDiskAdaptor.cc: New class.
  2520. * src/MultiDiskAdaptor.h: New class.
  2521. * src/MultiDiskAdaptor.cc: New class.
  2522. * src/CopyDiskAdaptor.h: New class.
  2523. * src/CopyDiskAdaptor.cc: New class.
  2524. * src/DiskAdaptor.h: New class.
  2525. * src/DiskAdaptor.cc: New class.
  2526. * src/prefs.h (PREF_TORRENT_SHOW_FILES): Renamed as PREF_SHOW_FILES
  2527. (PREF_SHOW_FILES): New definition.
  2528. 2006-04-12 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2529. To add the ability to download multi torrent into respective files
  2530. directly:
  2531. * src/DiskWriter.h (openFile): New function.
  2532. (seek): Removed.
  2533. * src/MultiDiskWriter.h: New class.
  2534. * src/MultiDiskWriter.cc: New class.
  2535. * src/AbstractDiskWriter.h (seek): Changed its scope from public to
  2536. protected.
  2537. (openFile): New function.
  2538. * src/AbstractDiskWriter.cc (openFile): New function.
  2539. * src/prefs.h (V_FALSE): New definition.
  2540. (PREF_DIRECT_FILE_MAPPING): New definition.
  2541. * src/TorrentMan.h (setupDiskWriter): New function.
  2542. (setAllMultiFileRequestedState): New function.
  2543. (onDownloadComplete): New function.
  2544. * src/TorrentMan.cc : Included MultiDiskWriter.h
  2545. (setupDiskWriter): New function.
  2546. (getFilePath): Updated.
  2547. (getTempFilePath): Updated.
  2548. (getSegmentFilePath): Updated.
  2549. (fixFilename): Updated.
  2550. (deleteTempFile): Updated.
  2551. (setAllMultiFileRequestedState): New function.
  2552. (setFileEntriesToDownload): Use setAllMultiFileRequestedState().
  2553. (finishPartialDownloadingMode): Reset requested flags.
  2554. (onDownloadComplete): New function.
  2555. * src/main.cc: Added --direct-file-mapping option.
  2556. Use TorrentMan::setupDiskWriter().
  2557. * src/TorrentDownloadEngine.cc (afterEachIteration): Use TorrentMan::
  2558. onDownloadComplete().
  2559. To fix ETA bug:
  2560. * src/Util.h (difftvsec): New function.
  2561. * src/Util.cc (difftvsec): New function.
  2562. * src/TorrentConsoleDownloadEngine.cc (calculateSpeed): Use int for the
  2563. type of "elapsed" instead of long long int.
  2564. (calculateStatistics): Use Util::difftvsec instead of Util::difftv.
  2565. The updates of statistics takes place every 1 seconds.
  2566. * src/TorrentConsoleDownloadEngine.h (lastElapsed): Changed its type.
  2567. (calculateSpeed): Changed its argument signature.
  2568. * src/PeerMessage.cc (toString): Fixed message.
  2569. 2006-04-06 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2570. To print ETA:
  2571. * src/TorrentDownloadEngine.cc (afterEachIteration): Added download
  2572. completion handling when dealing with
  2573. TorrentMan::isPartialDownloadingMode() == true.
  2574. * src/TorrentDownloadEngine.h (onPartialDownloadingCompletes):
  2575. New function.
  2576. * src/TorrentConsoleDownloadEngine.h (startup): New variable.
  2577. (sessionDownloadLength): New variable.
  2578. (avgSpeed): New variable.
  2579. (eta): New variable.
  2580. * src/TorrentConsoleDownloadEngine.cc (initStatistics): Initialized
  2581. new variables: eta, avgSpeed, startup.
  2582. (calculateSpeed): Calculate average speed and ETA.
  2583. (printStatistics): Added ETA.
  2584. * src/Util.h (secfmt): New function.
  2585. * src/Util.cc (secfmt): New function.
  2586. 2006-04-05 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2587. To detect "keep alive" flooding:
  2588. * src/PeerInteractionCommand.h (keepAliveCount): New variable
  2589. * src/PeerInteractionCommand.cc (Constructor): Initialized new
  2590. variable: keepAliveCount.
  2591. (detectMessageFlooding): Added "keep alive" flooding detection.
  2592. (receiveMessage): Increase keepAliveCount when "keep alive" message
  2593. received.
  2594. To add the ability to download only specified files in multi-file
  2595. torrent:
  2596. * src/BitfieldMan.h (filterBitfield): New variable.
  2597. (filterEnabled): New variable.
  2598. (setFilterBit): New function.
  2599. (enableFilter): New function.
  2600. (disableFilter): New function.
  2601. (isFilterEnabled): New function.
  2602. (getFilteredTotalLength): New function.
  2603. (getCompletedLength): New function.
  2604. * src/BitfieldMan.cc (Constructor): Initialized new variable:
  2605. filterBitfield, filterEnabled.
  2606. (CopyConstructor): Added filterBitfield and filterEnabled.
  2607. (operator==): Added filterBitfield and filterEnabled.
  2608. (Destructor): Added filterBitfield.
  2609. (getMissingIndex): Use filterBitfield.
  2610. (getMissingUnusedIndex): Use filterBitfield.
  2611. (getFirstMissingUnusedIndex): Use filterBitfield.
  2612. (getFirstMissingUnusedIndex): Use filterBitfield.
  2613. (getAllMissingIndexes): Use filterBitfield.
  2614. (countMissingBlock): Use filterBitfield.
  2615. (countBlock): Use filterBitfield.
  2616. (setBitInternal): Added new argument on.
  2617. (setUseBit): Use setBitInternal.
  2618. (unsetUseBit): Use setBitInternal.
  2619. (setBit): Use setBitInternal.
  2620. (unsetBit): Use setBitInternal.
  2621. (isAllBitSet): Use filterBitfield.
  2622. (setFilterBit): New function.
  2623. (addFilter): New function.
  2624. (enableFilter): New function.
  2625. (disableFilter): New function.
  2626. (clearFilter): New function.
  2627. (isFilterEnabled): New function.
  2628. (getFilteredTotalLength): New function.
  2629. (getCompletedLength): New function.
  2630. * src/TorrentMan.h [FileEntry](Constructor): Updated signature.
  2631. Initalized newly added variables.
  2632. [FileEntry](offset): New variable.
  2633. [FileEntry](extracted): New variable.
  2634. [FileEntry](requested): New variable.
  2635. (readFileEntry): New function.
  2636. (option): New variable.
  2637. (splitMultiFile): Removed const qualifier.
  2638. (fixFilename): Removed const qualifier.
  2639. (readFileEntryFromMetaInfoFile): New function.
  2640. (finishPartialDownloadingMode): New function.
  2641. (isPartialDownloadingMode): New function.
  2642. (setFileEntriesToDownload): New function.
  2643. (getCompletedLength): New function.
  2644. (getPartialTotalLength): New function.
  2645. * src/TorrentMan.cc (readFileEntry): New function.
  2646. (setup): Use readFileEntry. If no-preallocation option is specified,
  2647. use DefaultDiskWriter.
  2648. (readFileEntryFromMetaInfoFile): New function.
  2649. (fixFilename): Removed const qualifier.
  2650. (splitMultiFile): Removed const qualifier.
  2651. (setFileEntriesToDownload): New function.
  2652. (isPartialDownloadingMode): New function.
  2653. (finishPartialDownloadingMode): New function.
  2654. (getCompletedLength): New function.
  2655. (getPartialTotalLength): New function.
  2656. * src/TorrentConsoleDownloadEngine.h (partialDownloadLengthDiff):
  2657. New variable.
  2658. (partialTotalLength): New variable.
  2659. (downloadLength): New variable.
  2660. (totalLength): New variable.
  2661. * src/TorrentConsoleDownloadEngine.cc (onPartialDownloadingCompletes):
  2662. Added log.
  2663. (initStatistics): Initialized new variables: partialDownloadLengthDiff,
  2664. partialTotalLength, downloadLength, totalLength.
  2665. (calculate): Calculate downloadLength and totalLength.
  2666. * src/prefs.h :New definition PREF_NO_PREALLOCATION
  2667. * src/main.cc (addCommand): Changed argument signature.
  2668. (main): Added new variable: args. Added new option "torrent-show-files"
  2669. "no-preallocation". Usage is not updated yet.
  2670. 2006-04-02 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2671. * src/PeerMessage.cc (setBitfield): Fixed invalid memory de-allocation.
  2672. 2006-04-01 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2673. Attempt to add the ability to listing file entries in a .torrent file.
  2674. This feature is not yet complete.
  2675. * src/prefs.h (PREF_TORRENT_SHOW_FILES): New definition
  2676. * src/TorrentMan.cc (getMultiFileEntries): New function.
  2677. (getName): New function.
  2678. * src/TorrentMan.h (getMultiFileEntries): New function.
  2679. (getName): New function.
  2680. * src/main.cc (main): Use above 2 funtion.
  2681. * Release 0.3.2
  2682. 2006-03-31 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2683. * src/PeerInteractionCommand.cc (checkInactiveConnection): New function
  2684. (detectMessageFlooding): Updated threshold value.
  2685. (checkLongTimePeerChoking): Updated timeout value.
  2686. (getNewPieceAndSendInterest): Added debug log.
  2687. * src/PeerInteractionCommand.h (checkInactiveConnection): New function
  2688. * src/TorrentMan.cc (deleteOldErrorPeers): Updated.
  2689. (getPeer): Updated.
  2690. * src/TorrentMan.h: Added MAX_PEER_ERROR.
  2691. * src/PeerAbstractCommand.cc (onAbort): Increment error counter.
  2692. * src/PeerListenCommand.cc (execute): Close connection if incoming peer
  2693. is localhost.
  2694. * src/main.cc (main): Updated PREF_PEER_CONNECTION_TIMEOUT to 60.
  2695. * src/PendingMessage.cc (processMessage): Not to send piece message
  2696. if peer is not interested in the pieces localhost has.
  2697. * src/Peer.cc (shouldChoke): Updated.
  2698. * src/SendMessageQueue.cc (cancelAllRequest): Fixed.
  2699. * src/Util.cc (isPowerOf): New function.
  2700. * src/Util.h (isPowerOf): New function.
  2701. * src/PeerMessageUtil.cc (checkLength): Added a check for length
  2702. whether or not it is power of 2.
  2703. 2006-03-28 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2704. Added new class SendMessageQueue that includes PendingMessages and
  2705. RequestSlotMan.
  2706. * src/SendMessageQueue.h: New class.
  2707. * src/SendMessageQueue.cc: New class.
  2708. * src/PendingMessage.h: Added new member variable blockIndex and its
  2709. accessors.
  2710. (createRequestMessage): Updated.
  2711. * src/PendingMessage.cc (createRequestMessage): Updated.
  2712. * src/PeerInteractionCommand.cc (executeInternal): Updated with
  2713. SendMessageQueue.
  2714. (checkLongTimePeerChoking): Updated with SendMessageQueue.
  2715. (receiveMessage): Updated with SendMessageQueue.
  2716. (deletePendingPieceMessage): Removed.
  2717. (getNewPieceAndSendInterest): Updated with SendMessageQueue.
  2718. (sendInterest): Updated with SendMessageQueue.
  2719. (createRequestPendingMessage): Updated with SendMessageQueue.
  2720. (sendMessages): Updated with SendMessageQueue.
  2721. (onAbort): Updated with SendMessageQueue.
  2722. (keepAlive): Updated with SendMessageQueue.
  2723. (beforeSocketCheck): Updated SendMessageQueue.
  2724. * src/PeerInteractionCommand (sendMessages): Shuffle
  2725. missingBLockIndexes before using it.
  2726. Added its own timeout for peer connection.
  2727. * src/PeerAbstractCommand.h: Added member variable timeout and its
  2728. setter.
  2729. * src/prefs.h: Added PREF_PEER_CONNECTION_TIMEOUT.
  2730. * src/PeerInteractionCommand.cc (PeerInteractionCommand):
  2731. Added setTimeout() call.
  2732. (executeInternal): Added setTimeout() call.
  2733. * src/PeerAbstractCommand.cc (PeerAbstractCommand):
  2734. Added timeout.
  2735. (isTimeoutDetected): Updated.
  2736. * src/main.cc (main): Added PREF_PEER_CONNECTION_TIMEOUT entry to
  2737. option.
  2738. Added *simple* message flooding checker.
  2739. * src/PeerInteractionCommand.cc (executeInternal):
  2740. Added detectMessageFlooding() call.
  2741. (detectMessageFlooding): New function.
  2742. (receiveMessage): Count up CHOKE, UNCHOKE, HAVE message.
  2743. (beforeSocketCheck): Added detectMessageFlooding() call.
  2744. * src/PeerInteractionCommand.h: Added sendMessageQueue,
  2745. chokeUnchokeCount, haveCount, detectMessageFlooding().
  2746. Removed deletePendingPieceMessage(), getRequestSlot(),
  2747. deleteRequestSlot(), deleteAllRequestSlot().
  2748. * src/PeerInteractionCommand.cc (beforeSocketCheck):
  2749. Added checkLongTimePeerChoking() call.
  2750. * src/RequestSlotMan.h: Renamed deleteTimeoutRequestSlot().
  2751. * src/TorrentMan.cc (addPeer): Delete at most MAX_PEER_LIST_SIZE peers
  2752. if duplicate == false.
  2753. The parameter "uploaded" and "downloaded" in the tracker request are
  2754. the size since the client sent the "started" event to the tracker.
  2755. * src/TorrentMan.cc (setup): Assigned saved downloaded Size and
  2756. uploaded size to preDownloadedSize, preUploadedSize respectively.
  2757. * src/TorrentMan.h: Added preDownloadedSize, preUploadedSize,
  2758. getSessionDownloadedSize(), getSessionUploadedSize().
  2759. * src/TrackerInitCommand.cc (execute): Use getSessionDownloadedSize(),
  2760. getSessionUploadedSize() instead of getDownloadedSize(),
  2761. getUploadedSize().
  2762. * src/PendingMessage.cc (processMessage): Do not send request message
  2763. if the peer is choking the client.
  2764. * src/TrackerUpdateCommand.cc (execute): Check wtheher minInterval is
  2765. less than interval.
  2766. 2006-03-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2767. * configure.in: Added gnutls support. Added several CPP macros.
  2768. * m4/openssl.m4: Added.
  2769. * src/SocketCore.{h,cc}: Drop const quarifier from writeData(),
  2770. readData(), peekData(). Added gnutls support.
  2771. * src/HttpDownloadCommand.cc: Removed SleepCommand.h
  2772. * src/TrackerWatcherCommand.{h,cc}: Added. This command creates
  2773. TrackerInitCommand periodicaly(TorrentMan::minInterval).
  2774. * src/TorrentMan.cc: Remove downloadedSize == 0 check from save().
  2775. Instead, added a check for whether setup method has executed
  2776. successfully.
  2777. * src/TorrentMan.h: Added member vaiable setupComplete. Updated
  2778. DEFAULT_ANNOUNCE_INTERVAL and DEFAULT_ANNOUNCE_MIN_INTERVAL to 300.
  2779. * src/Makefile.am: Updated.
  2780. * src/messageDigest.h: Added. This is a macro calculating SHA1 digest
  2781. using whether OpenSSL or gcrypt, depending on the result of configure
  2782. script.
  2783. * src/ShaVisitor.{h,cc}: Removed direct dependency on OpenSSL by using
  2784. messageDigest.h.
  2785. * src/TorrentAutoSaveCommand.h: Removed unused variable cuid.
  2786. * src/PeerListenCommand.cc: Added log about port binded successfully.
  2787. Fixed memory leak.
  2788. * src/main.cc: Added gnutls support. Replaced LIB_SSL with
  2789. ENABLE_BITTORRENT where they are not related to OpenSSL but BitTorrent.
  2790. Removed instantiation of TrackerInitCommand. Instead,
  2791. TrackerWatcherCommand is instantiated and pushed to the command queue.
  2792. * src/InitiateConnectionCommandFactory.cc: Replaced HAVE_LIBSSL with
  2793. ENABLE_SSL.
  2794. * src/Request.cc: Replaced HAVE_LIBSSL with ENABLE_SSL.
  2795. * src/RequestSlotMan.cc (deleteCompletedRequestSlot):
  2796. If a piece is already acquired by another command, delete the request
  2797. slots for the piece.
  2798. * src/TrackerUpdateCommand.cc (execute):
  2799. Changed log level of MSG_TRACKER_WARNING_MESSAGE from info to warn.
  2800. Added a check whether peer list is null.
  2801. Fixed the bug that causes sending completed event to the tracker
  2802. several times.
  2803. * src/TrackerInitCommand.cc (execute):
  2804. Fixed the bug that causes sending completed event to the tracker
  2805. several times.
  2806. * src/AbstractDiskWriter.{h,cc}: Removed direct dependency on OpenSSL
  2807. by using messageDigest.h.
  2808. 2006-03-26 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2809. * PeerConnection.cc: Replaced log message "keep-alive" with
  2810. "keep alive".
  2811. * PeerInteractionCommand.{h,cc}: Close connection if peer is choking
  2812. localhost long time.
  2813. * TorrentMan.cc: When adding new peer with duplicate = true, if the
  2814. number of peer list is equal to or grater than MAX_PEER_LIST, delete
  2815. at most 100 failure entry from the list. If with duplicate = false,
  2816. MAX_PEER_LIST is not checked.
  2817. * PeerListenCommand.cc: Fixed the argument order of log message.
  2818. 2006-03-25 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2819. * Logger.h: Moved enum LEVEL from SimpleLogger.h to here.
  2820. Added warn().
  2821. * SimpleLogger.h: Moved enum LEVEL to Logger.h.
  2822. Implemented warn().
  2823. Defined 2 macros(WRITE_LOG, WRITE_LOG_EX) to avoid duplicated code.
  2824. 2006-03-24 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2825. * Request.h: Added AFTER_COMPLETED event.
  2826. * TorrentDownloadEngine.cc: Prints "Download complete" message
  2827. instead of downloaded size and progress(%) after download completes.
  2828. * PeerInteractionCommand.cc: After download completes, sends unchoke
  2829. message to the peer if it is interested in what localhost has
  2830. downloaded.
  2831. * TorrentMan.cc: In single-file mode, copy temporary file to the final
  2832. destination instead of just renaming it.
  2833. * TorrentMan.cc: Added deleteTempFile().
  2834. * PeerAbstractCommand.cc: do not stop execution after download
  2835. completes. This makes localhost a seeder.
  2836. * Util.{h,cc}: Added fileCopy().
  2837. * PeerListenCommand.cc: do not stop execution after download completes.
  2838. This makes localhost a seeder.
  2839. * main.cc: Do not call TorrentMan::fixFilename() in torrentHandler.
  2840. Added TorrentMan::deleteTempFile() to torrentHandler.
  2841. Initialized the variable dir as ".".
  2842. * TorrentMan.h: Changed DEFAULT_ANNOUNCE_INTERVAL to 120 seconds.
  2843. Deleted renameSingleFile().
  2844. Added copySingleFile(), deleteTempFile().
  2845. * DownloadEngine.h: Added virtual function afterEachIteration().
  2846. * TorrentDownloadEngine.cc: Move a call to TorrentMan::fixFilename()
  2847. in onEndOfRun() to afterEachIteration().
  2848. In onEndOfRun(), changed if condition to check whether filenameFixed is
  2849. true.
  2850. * Util.cc: Implemented fileCopy() using rangedFileCopy().
  2851. In rangedFileCopy(), added try-catch block to properly close file
  2852. descriptors.
  2853. * TorrentDownloadEngine.cc: Added a member variable filenameFixed.
  2854. Added afterEachIteration(), isFilenameFixed().
  2855. * Peer.cc: Changed choking strategy.
  2856. * PreAllocationDiskWriter.cc: Drop O_DIRECT flag.
  2857. * TrackerInitCommand.cc: Send completed event only once.
  2858. * DownloadEngine.cc: Added a call to afterEachIteration().
  2859. * TrackerUpdateCommand.cc: Do not stop execution after download
  2860. completes.
  2861. * TorrentMan.h: Defined MAX_PEER_UPDATE as 15. aria2 attempts to
  2862. connect the peers at most MAX_PEER_UPDATE when a peer list is
  2863. received from a tracker.
  2864. * TrackerUpdateCommand.cc: Implemented above mentioned behavior.
  2865. Decreased the number of failure peers to delete to 0(just comment out
  2866. the line).
  2867. * Release 0.3.1
  2868. 2006-03-23 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2869. * PeerInteractionCommand.cc: added a call to
  2870. TorrentMan::unadvertisePiece in Destructor.
  2871. * PeerInteractionCommand.cc: make have message sent immediately
  2872. if the size of pending message queue is zero.
  2873. * TorrentMan.cc: set the maximum size of peer list to 250.
  2874. * TorrentMan.h: changed the container type of Peers and UsedPieces
  2875. to deque.
  2876. * Util.cc: fixed rangedFileCopy.
  2877. * AbstractDiskWriter.{h,cc}: moved digest context initialization
  2878. to Constructor. Also, moved digest cleanup to Destructor.
  2879. * MetaFileUtil.cc: fixed memory leak
  2880. * replaced std::vector with std::deque.
  2881. * AbstractCommand.cc: casted timeout value to long long int.
  2882. * ChunkedEncoding.cc: fixed memory leak.
  2883. * PeerInteractionCommand.cc: casted timeout value to long long int.
  2884. * SleepCommand.cc: casted timeout value to long long int.
  2885. * Data.cc: fixed memory leak.
  2886. * Data.cc: fixed toLLInt().
  2887. * BitfieldMan.cc: fixed memory leak.
  2888. * TorrentMan.cc: initialized storeDir to ".".
  2889. * TorrentMan.cc: fixed memory leak.
  2890. * TorrentMan.cc: corrected file paths of splitted files.
  2891. * PeerAbstractCommand.cc: casted timeout to long long int.
  2892. * main.cc: added delete(req) and delete(te->diskWriter).
  2893. * RequestSlot.cc: casted timeout value to long long int.
  2894. * Request.cc: fixed memory leak.
  2895. * PendingMessage.cc: make HAVE messages sent only when peer does not
  2896. have the piece.
  2897. * Peer.{h,cc}: added hasPiece(int index).
  2898. * main.cc: corrected addCommand.
  2899. 2006-03-22 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2900. * BitTorrent protocol support added.
  2901. * Release 0.3.0
  2902. 2006-03-17 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2903. * SocketCore.cc: remove the assignment of addrinfo.ai_addr.
  2904. 2006-03-09 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2905. * ChunkedEncoding.{h,cc}: fixed the bug that if chunk data is binary,
  2906. decoding did not work properly.
  2907. 2006-03-07 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2908. * DownloadEngine.h: included sys/time.h
  2909. * DownloadEngine.cc: remove sys/time.h
  2910. * Makefile.am (SUBDIRS): Add intl.
  2911. * configure.in (AC_CONFIG_FILES): Add intl/Makefile.
  2912. 2006-03-05 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2913. * main.cc: correct help message for --http-auth-scheme.
  2914. * main.cc: changed e-mail address for bug reports.
  2915. * ja.po: added japanese translation.
  2916. 2006-03-04 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2917. * SimpleLogger.cc: flush log file instead of stdout.
  2918. 2006-03-03 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2919. * main.cc: Fixed command-line option: max-tries
  2920. * HttpResponseCommand.cc: Make the request re-sent only if req->seg.sp
  2921. does not equal to seg.sp.
  2922. * DownloadCommand.cc: If EOF is got from the server and the total size
  2923. of file is not zero, then throw DlRetryEx.
  2924. * main.cc: Set the minium value of min-segment-size to 1024.
  2925. * HttpResponseCommand.cc: Fixed the bug that http segmented downloading
  2926. fails because of a regression since 0.2.0 release.
  2927. 2006-03-02 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2928. * HttpConnection.cc:
  2929. * common.h: defined the user agent name as macro
  2930. * DownloadEngine.{h, cc}:
  2931. * ConsoleDownloadEngine.{h, cc}: Console output message(size, speed)
  2932. is now generated by ConsoleDownloadEngine not by DownloadEngine.
  2933. * main.cc: Download complete/abort message is now generated by main.
  2934. * Makefile.am (SUBDIRS): Add m4.
  2935. (ACLOCAL_AMFLAGS): New variable.
  2936. (EXTRA_DIST): New variable.
  2937. * configure.in (AC_CONFIG_FILES): Add po/Makefile.in,
  2938. * gettext: added gettext functionality
  2939. 2006-03-01 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2940. * AbstractCommand.cc:
  2941. * DownloadCommand.{h, cc}: Aborted downloading commands now properly
  2942. unregister its cuid from SegmentMan.
  2943. * DownloadEngine.cc: .aria2 file was written when a downloading
  2944. failed with errors.
  2945. * HttpConnection.cc: Added "Proxy-Connection" header to proxy request.
  2946. Added "User-Agent" header to CONNECT proxy request.
  2947. Fixed "Proxy-Authorization" header. Now proxy authorization works
  2948. properly.
  2949. * Logger.h:
  2950. * SimpleLogger.{h,cc}: Changed the type of msg to const char*.
  2951. * ChunkedEncoding.cc: Added #include directive for strings.h
  2952. * Release 0.2.1
  2953. 2006-02-28 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2954. * Util.{h,cc}: added startsWith().
  2955. * CookieBox.cc: rewrited criteriaFind() using Util::startsWith() and
  2956. Util::endsWith().
  2957. * SocketCore.cc: struct addrinfo is now zero-initialized.
  2958. * common.h: added #include directive of limit.h.
  2959. * DownloadEngine.cc: added #include directive of sys/time.h and
  2960. algorithm.
  2961. * Exception.h: added #include directive of stdio.h.
  2962. * AbstractCommand.h: added #include directive of sys/time.h.
  2963. * DownloadCommand.h: added #include directive of sys/time.h.
  2964. * *.h: added #include directive of common.h to all base classes.
  2965. subclasses' one was removed.
  2966. * common.h: defined LONG_LONG_MAX and LONG_LONG_MIN if a compiler
  2967. does not define these macros.
  2968. 2006-02-23 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2969. * Release 0.2.0
  2970. * main.cc:
  2971. * HttpInitiateConnectionCommand.{h,cc}:
  2972. * prefs.h:
  2973. * HttpConnection.{h,cc}: added --http-proxy-method option.
  2974. We can now use GET command in http proxy.
  2975. 2006-02-22 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2976. * SplitSlowestSegmentSplitter.{h,cc}: This class provies algorithm
  2977. that splits slowest segment of SegmentMan::commands vector.
  2978. This is the default split algorithm of aria2.
  2979. * SplitFirstSegmentSplitter.{h,cc}: This class provides algorithm
  2980. that splits first segment of SegmentMan::commands vector.
  2981. * SegmentSplitter.{h,cc}: Added. This class provides split algorithm.
  2982. * DownloadCommand.{h,cc}: Added downloading speed calculation.
  2983. * Segment.h:
  2984. * SegmentMan.cc: Added speed field to Segment.h
  2985. * main.cc: -s option now affects all URLs in command-line arguemtns.
  2986. * HttpResponseCommand.cc: Fixed bug that segment file is not loaded.
  2987. * message.h: Change file size related %d to %lld.
  2988. 2006-02-21 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  2989. * FtpInitiateConnectionCommand.{h,cc}:
  2990. * FtpNegotiationCommand.{h,cc}:
  2991. * FtpDownloadCommand.{h,cc}:
  2992. * FtpConnection.{h,cc}: Added FTP support
  2993. * SimpleLogger.cc: Log message now includes time information.
  2994. * main.cc: The value of --http-auth-scheme option is chagned from
  2995. 'BASIC' to 'basic'
  2996. * main.cc: Added --timeout command-line option.
  2997. * main.cc: Added --min-segment-size command-line option.
  2998. * main.cc: Added --max-retries command-line option.
  2999. * prefs.h: option string constants are now defined in prefs.h
  3000. 2006-02-19 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  3001. * AbstractCommand.cc: Fixed timeout bug in AbstractCommand
  3002. * SegmentMan.cc: Added totalSize entry to .aria2 file. No compatibility
  3003. with version 0.1.0's one.
  3004. 2006-02-18 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
  3005. * configure.in: Added --enable-ssl option to configure script.
  3006. * HttpConnection.cc: Make Request-URI an absolute path. Some servers
  3007. cannot permit absoluteURI as Request-URI.
  3008. * HttpConnection.cc: Added Referer support.
  3009. * main.cc: Added referer command-line option.
  3010. * main.cc: Added rety-wait command-line option.
  3011. * Exception.h: Fixed formating bug in Exception::setMsg()
  3012. * SocketCore.{h,cc}:
  3013. * Socket.{h, cc}:
  3014. * Request.cc:
  3015. * InitiateConnectionCommandFactory.cc:
  3016. * HttpRequestCommand.cc: Added HTTPS support.
  3017. * SocketCore.{h,cc}: Added SocketCore. Socket becomes a handle class
  3018. for SocketCore.
  3019. * ChunkedEncoding.cc: Fixed bug in ChunkedEncoding: expanding buffer
  3020. size is wrong
  3021. * DownloadCommand.cc: Fixed bug in DownloadCommand: In Chunked
  3022. Encoding, it wrongly adds to Segment.ds buff length from the socket.
  3023. 2006-02-17 Tatsuhiro Tsujikawa <tsujikawa at rednoah dot com>
  3024. * Release 0.1.0