ChangeLog 122 KB

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