ChangeLog 82 KB

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