ChangeLog 115 KB

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