ChangeLog 68 KB

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