ChangeLog 102 KB

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