ChangeLog 81 KB

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