ChangeLog 66 KB

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