ChangeLog 116 KB

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