ChangeLog 85 KB

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