ChangeLog 84 KB

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