ChangeLog 135 KB

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