ChangeLog 87 KB

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