ChangeLog 111 KB

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