ChangeLog 112 KB

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