ChangeLog 109 KB

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