ChangeLog 83 KB

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