ChangeLog 88 KB

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