Browse Source

* src/SocketCore.cc
(writeData): Removed timeout argument.
(readData): Removed timeout argument.
(peekData): Removed timeout argument.
* src/Socket.cc
(writeData): Removed timeout argument.
(readData): Removed timeout argument.
(peekData): Removed timeout argument.

Tatsuhiro Tsujikawa 19 years ago
parent
commit
15b207a53e
13 changed files with 55 additions and 48 deletions
  1. 14 1
      ChangeLog
  2. 10 10
      configure
  3. 1 1
      configure.ac
  4. 1 1
      po/Makefile.in
  5. BIN
      po/ja.gmo
  6. 6 3
      po/ja.po
  7. 0 3
      src/SendMessageQueue.cc
  8. 8 8
      src/Socket.cc
  9. 4 4
      src/Socket.h
  10. 3 3
      src/SocketCore.cc
  11. 3 9
      src/SocketCore.h
  12. 2 2
      src/TorrentDownloadEngine.cc
  13. 3 3
      src/main.cc

+ 14 - 1
ChangeLog

@@ -8,7 +8,20 @@
 	(unfoldSubRange): New function
 	(unfoldSubRange): New function
 	* src/main.cc
 	* src/main.cc
 	(showUsage): Added help message.
 	(showUsage): Added help message.
-	(main): Added --select-file command-line option.
+	(main): Added --select-file command-line option. Updated the layout of
+	file listing.
+	* src/common.h
+	(Integers): New definition.
+
+	* src/SocketCore.cc
+	(writeData): Removed timeout argument.
+	(readData): Removed timeout argument.
+	(peekData): Removed timeout argument.
+	* src/Socket.cc
+	(writeData): Removed timeout argument.
+	(readData): Removed timeout argument.
+	(peekData): Removed timeout argument.
+	
 	
 	
 2006-04-28  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
 2006-04-28  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
 
 

+ 10 - 10
configure

@@ -1,6 +1,6 @@
 #! /bin/sh
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.59 for aria2c 0.4.0.
+# Generated by GNU Autoconf 2.59 for aria2c 0.4.1.
 #
 #
 # Report bugs to <tujikawa@rednoah.com>.
 # Report bugs to <tujikawa@rednoah.com>.
 #
 #
@@ -269,8 +269,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
 # Identity of this package.
 # Identity of this package.
 PACKAGE_NAME='aria2c'
 PACKAGE_NAME='aria2c'
 PACKAGE_TARNAME='aria2c'
 PACKAGE_TARNAME='aria2c'
-PACKAGE_VERSION='0.4.0'
-PACKAGE_STRING='aria2c 0.4.0'
+PACKAGE_VERSION='0.4.1'
+PACKAGE_STRING='aria2c 0.4.1'
 PACKAGE_BUGREPORT='tujikawa@rednoah.com'
 PACKAGE_BUGREPORT='tujikawa@rednoah.com'
 
 
 ac_unique_file="src/Socket.h"
 ac_unique_file="src/Socket.h"
@@ -788,7 +788,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
   cat <<_ACEOF
-\`configure' configures aria2c 0.4.0 to adapt to many kinds of systems.
+\`configure' configures aria2c 0.4.1 to adapt to many kinds of systems.
 
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
 
@@ -854,7 +854,7 @@ fi
 
 
 if test -n "$ac_init_help"; then
 if test -n "$ac_init_help"; then
   case $ac_init_help in
   case $ac_init_help in
-     short | recursive ) echo "Configuration of aria2c 0.4.0:";;
+     short | recursive ) echo "Configuration of aria2c 0.4.1:";;
    esac
    esac
   cat <<\_ACEOF
   cat <<\_ACEOF
 
 
@@ -994,7 +994,7 @@ fi
 test -n "$ac_init_help" && exit 0
 test -n "$ac_init_help" && exit 0
 if $ac_init_version; then
 if $ac_init_version; then
   cat <<\_ACEOF
   cat <<\_ACEOF
-aria2c configure 0.4.0
+aria2c configure 0.4.1
 generated by GNU Autoconf 2.59
 generated by GNU Autoconf 2.59
 
 
 Copyright (C) 2003 Free Software Foundation, Inc.
 Copyright (C) 2003 Free Software Foundation, Inc.
@@ -1008,7 +1008,7 @@ cat >&5 <<_ACEOF
 This file contains any messages produced by compilers while
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 running configure, to aid debugging if configure makes a mistake.
 
 
-It was created by aria2c $as_me 0.4.0, which was
+It was created by aria2c $as_me 0.4.1, which was
 generated by GNU Autoconf 2.59.  Invocation command line was
 generated by GNU Autoconf 2.59.  Invocation command line was
 
 
   $ $0 $@
   $ $0 $@
@@ -1651,7 +1651,7 @@ fi
 
 
 # Define the identity of the package.
 # Define the identity of the package.
  PACKAGE='aria2c'
  PACKAGE='aria2c'
- VERSION='0.4.0'
+ VERSION='0.4.1'
 
 
 
 
 cat >>confdefs.h <<_ACEOF
 cat >>confdefs.h <<_ACEOF
@@ -11529,7 +11529,7 @@ _ASBOX
 } >&5
 } >&5
 cat >&5 <<_CSEOF
 cat >&5 <<_CSEOF
 
 
-This file was extended by aria2c $as_me 0.4.0, which was
+This file was extended by aria2c $as_me 0.4.1, which was
 generated by GNU Autoconf 2.59.  Invocation command line was
 generated by GNU Autoconf 2.59.  Invocation command line was
 
 
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_FILES    = $CONFIG_FILES
@@ -11592,7 +11592,7 @@ _ACEOF
 
 
 cat >>$CONFIG_STATUS <<_ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF
 ac_cs_version="\\
 ac_cs_version="\\
-aria2c config.status 0.4.0
+aria2c config.status 0.4.1
 configured by $0, generated by GNU Autoconf 2.59,
 configured by $0, generated by GNU Autoconf 2.59,
   with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
   with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
 
 

+ 1 - 1
configure.ac

@@ -2,7 +2,7 @@
 # Process this file with autoconf to produce a configure script.
 # Process this file with autoconf to produce a configure script.
 #
 #
 AC_PREREQ(2.59)
 AC_PREREQ(2.59)
-AC_INIT(aria2c, 0.4.0, tujikawa@rednoah.com)
+AC_INIT(aria2c, 0.4.1, tujikawa@rednoah.com)
 AM_INIT_AUTOMAKE()
 AM_INIT_AUTOMAKE()
 AM_PATH_CPPUNIT(1.10.2)
 AM_PATH_CPPUNIT(1.10.2)
 AC_CONFIG_SRCDIR([src/Socket.h])
 AC_CONFIG_SRCDIR([src/Socket.h])

+ 1 - 1
po/Makefile.in

@@ -9,7 +9,7 @@
 # General Public License and is *not* in the public domain.
 # General Public License and is *not* in the public domain.
 
 
 PACKAGE = aria2c
 PACKAGE = aria2c
-VERSION = 0.4.0
+VERSION = 0.4.1
 
 
 SHELL = /bin/sh
 SHELL = /bin/sh
 
 

BIN
po/ja.gmo


+ 6 - 3
po/ja.po

@@ -705,9 +705,12 @@ msgid ""
 "\".\n"
 "\".\n"
 "                              ',' and '-' can be used together.\n"
 "                              ',' and '-' can be used together.\n"
 msgstr ""
 msgstr ""
-" --select-file=INDEX...       インデックスでダウンロード対象ファイルを指定しま\n"
-"                              す. インデックスは --show-files オプションで知る\n"
-"                              ことができます. 複数のインデックスを ',' で区切っ\n"
+" --select-file=INDEX...       インデックスでダウンロード対象ファイルを指定し"
+"ま\n"
+"                              す. インデックスは --show-files オプションで知"
+"る\n"
+"                              ことができます. 複数のインデックスを ',' で区"
+"切っ\n"
 "                              て指定できます: \"3,6\"\n"
 "                              て指定できます: \"3,6\"\n"
 "                              また, '-' を使って範囲指定もできます: \"1-5\"\n"
 "                              また, '-' を使って範囲指定もできます: \"1-5\"\n"
 "                              ',' と '-' は組み合わせて使うことができます.\n"
 "                              ',' と '-' は組み合わせて使うことができます.\n"

+ 0 - 3
src/SendMessageQueue.cc

@@ -35,14 +35,12 @@ SendMessageQueue::~SendMessageQueue() {
 }
 }
 
 
 void SendMessageQueue::send(int uploadSpeed) {
 void SendMessageQueue::send(int uploadSpeed) {
-  //logger->debug("SendMessageQueue:send start");
   int size = pendingMessages.size();
   int size = pendingMessages.size();
   for(int i = 0; i < size; i++) {
   for(int i = 0; i < size; i++) {
     PendingMessage msg = pendingMessages.front();
     PendingMessage msg = pendingMessages.front();
     pendingMessages.pop_front();
     pendingMessages.pop_front();
     if(uploadLimit != 0 && uploadSpeed >= uploadLimit*1024 &&
     if(uploadLimit != 0 && uploadSpeed >= uploadLimit*1024 &&
        msg.getPeerMessageId() == PeerMessage::PIECE && !msg.isInProgress()) {
        msg.getPeerMessageId() == PeerMessage::PIECE && !msg.isInProgress()) {
-      //logger->debug("upload speed limiter enabled, uploadSpeed=%d", uploadSpeed);
       pendingMessages.push_back(msg);
       pendingMessages.push_back(msg);
     } else {
     } else {
       if(!msg.processMessage()) {
       if(!msg.processMessage()) {
@@ -51,7 +49,6 @@ void SendMessageQueue::send(int uploadSpeed) {
       }
       }
     }
     }
   }
   }
-  //logger->debug("SendMessageQueue:send end");
 }
 }
 
 
 void SendMessageQueue::addPendingMessage(const PendingMessage& pendingMessage) {
 void SendMessageQueue::addPendingMessage(const PendingMessage& pendingMessage) {

+ 8 - 8
src/Socket.cc

@@ -89,20 +89,20 @@ bool Socket::isReadable(int timeout) const {
   return core->isReadable(timeout);
   return core->isReadable(timeout);
 }
 }
 
 
-void Socket::writeData(const char* data, int len, int timeout) const {
-  core->writeData(data, len, timeout);
+void Socket::writeData(const char* data, int len) const {
+  core->writeData(data, len);
 }
 }
 
 
-void Socket::writeData(const string& str, int timeout) const {
-  core->writeData(str.c_str(), str.size(), timeout);
+void Socket::writeData(const string& str) const {
+  core->writeData(str.c_str(), str.size());
 }
 }
 
 
-void Socket::readData(char* data, int& len, int timeout) const {
-  core->readData(data, len, timeout);
+void Socket::readData(char* data, int& len) const {
+  core->readData(data, len);
 }
 }
 
 
-void Socket::peekData(char* data, int& len, int timeout) const {
-  core->peekData(data, len, timeout);
+void Socket::peekData(char* data, int& len) const {
+  core->peekData(data, len);
 }
 }
 
 
 void Socket::initiateSecureConnection() const {
 void Socket::initiateSecureConnection() const {

+ 4 - 4
src/Socket.h

@@ -96,22 +96,22 @@ public:
   /**
   /**
    * @see SocketCore::writeData()
    * @see SocketCore::writeData()
    */
    */
-  void writeData(const char* data, int len, int timeout = 5) const;
+  void writeData(const char* data, int len) const;
   /**
   /**
    * A covenient function that can take string class parameter and
    * A covenient function that can take string class parameter and
    * internally calls SocketCore::writeData().
    * internally calls SocketCore::writeData().
    */
    */
-  void writeData(const string& str, int timeout = 5) const;
+  void writeData(const string& str) const;
 
 
   /**
   /**
    * @see SocketCore::readData()
    * @see SocketCore::readData()
    */
    */
-  void readData(char* data, int& len, int timeout = 5) const;
+  void readData(char* data, int& len) const;
 
 
   /**
   /**
    * @see SocketCore::peekData()
    * @see SocketCore::peekData()
    */
    */
-  void peekData(char* data, int& len, int timeout = 5) const;
+  void peekData(char* data, int& len) const;
 
 
   /**
   /**
    * @see SocketCore::initiateSecureConnection()
    * @see SocketCore::initiateSecureConnection()

+ 3 - 3
src/SocketCore.cc

@@ -262,7 +262,7 @@ bool SocketCore::isReadable(int timeout) const {
   }
   }
 }
 }
 
 
-void SocketCore::writeData(const char* data, int len, int timeout) {
+void SocketCore::writeData(const char* data, int len) {
   int ret = 0;
   int ret = 0;
   if(!secure && (ret = send(sockfd, data, (size_t)len, 0)) != len
   if(!secure && (ret = send(sockfd, data, (size_t)len, 0)) != len
 #ifdef HAVE_LIBSSL
 #ifdef HAVE_LIBSSL
@@ -288,7 +288,7 @@ void SocketCore::writeData(const char* data, int len, int timeout) {
   }
   }
 }
 }
 
 
-void SocketCore::readData(char* data, int& len, int timeout) {
+void SocketCore::readData(char* data, int& len) {
   int ret = 0;
   int ret = 0;
   if(!secure && (ret = recv(sockfd, data, (size_t)len, 0)) < 0
   if(!secure && (ret = recv(sockfd, data, (size_t)len, 0)) < 0
 #ifdef HAVE_LIBSSL
 #ifdef HAVE_LIBSSL
@@ -315,7 +315,7 @@ void SocketCore::readData(char* data, int& len, int timeout) {
   len = ret;
   len = ret;
 }
 }
 
 
-void SocketCore::peekData(char* data, int& len, int timeout) {
+void SocketCore::peekData(char* data, int& len) {
   int ret = 0;
   int ret = 0;
   if(!secure && (ret = recv(sockfd, data, (size_t)len, MSG_PEEK)) < 0
   if(!secure && (ret = recv(sockfd, data, (size_t)len, MSG_PEEK)) < 0
 #ifdef HAVE_LIBSSL
 #ifdef HAVE_LIBSSL

+ 3 - 9
src/SocketCore.h

@@ -139,10 +139,8 @@ public:
    * for this method call.
    * for this method call.
    * @param data data to write
    * @param data data to write
    * @param len length of data
    * @param len length of data
-   * @param timeout the amount of time elapsed before isWritable()
-   * are timed out.
    */
    */
-  void writeData(const char* data, int len, int timeout = 0);
+  void writeData(const char* data, int len);
 
 
   /**
   /**
    * Reads up to len bytes from this socket.
    * Reads up to len bytes from this socket.
@@ -155,10 +153,8 @@ public:
    * @param data holder to store data.
    * @param data holder to store data.
    * @param len the maximum size data can store. This method assigns
    * @param len the maximum size data can store. This method assigns
    * the number of bytes read to len.
    * the number of bytes read to len.
-   * @param timeout the amount of time elapsed before isReadable() are timed
-   * out.
    */
    */
-  void readData(char* data, int& len, int timeout = 0);
+  void readData(char* data, int& len);
 
 
   /**
   /**
    * Reads up to len bytes from this socket, but bytes are not removed from
    * Reads up to len bytes from this socket, but bytes are not removed from
@@ -168,10 +164,8 @@ public:
    * @param data holder to store data.
    * @param data holder to store data.
    * @param len the maximum size data can store. This method assigns
    * @param len the maximum size data can store. This method assigns
    * the number of bytes read to len.
    * the number of bytes read to len.
-   * @param timeout the amount of time elapsed before isReadable() are timed
-   * out.
    */
    */
-  void peekData(char* data, int& len, int timeout = 0);
+  void peekData(char* data, int& len);
   
   
   /**
   /**
    * Makes this socket secure.
    * Makes this socket secure.

+ 2 - 2
src/TorrentDownloadEngine.cc

@@ -96,10 +96,10 @@ void TorrentDownloadEngine::calculateStatistics() {
     totalLength = torrentMan->getTotalLength();
     totalLength = torrentMan->getTotalLength();
   }
   }
   
   
+  downloadSpeed = calculateSpeed(sessionDownloadLengthArray[currentCp], elapsed);
+  uploadSpeed = calculateSpeed(sessionUploadLengthArray[currentCp], elapsed);
 
 
   if(elapsed-lastElapsed >= 1) {
   if(elapsed-lastElapsed >= 1) {
-    downloadSpeed = calculateSpeed(sessionDownloadLengthArray[currentCp], elapsed);
-    uploadSpeed = calculateSpeed(sessionUploadLengthArray[currentCp], elapsed);
     avgSpeed = calculateSpeed(sessionDownloadLength,
     avgSpeed = calculateSpeed(sessionDownloadLength,
 			      Util::difftvsec(now, startup));
 			      Util::difftvsec(now, startup));
     if(avgSpeed < 0) {
     if(avgSpeed < 0) {

+ 3 - 3
src/main.cc

@@ -670,13 +670,13 @@ int main(int argc, char* argv[]) {
 	  te->torrentMan->readFileEntryFromMetaInfoFile(targetTorrentFile);
 	  te->torrentMan->readFileEntryFromMetaInfoFile(targetTorrentFile);
 	cout << _("Files:") << endl;
 	cout << _("Files:") << endl;
 	cout << "idx|path/length" << endl;
 	cout << "idx|path/length" << endl;
-	cout << "===============================================================================" << endl;
+	cout << "===+===========================================================================" << endl;
 	int count = 1;
 	int count = 1;
 	for(FileEntries::const_iterator itr = fileEntries.begin();
 	for(FileEntries::const_iterator itr = fileEntries.begin();
 	    itr != fileEntries.end(); count++, itr++) {
 	    itr != fileEntries.end(); count++, itr++) {
-	  printf("%3d %s\n    %s Bytes\n", count, itr->path.c_str(),
+	  printf("%3d|%s\n   |%s Bytes\n", count, itr->path.c_str(),
 		 Util::llitos(itr->length, true).c_str());
 		 Util::llitos(itr->length, true).c_str());
-	  cout << "-------------------------------------------------------------------------------" << endl;
+	  cout << "---+---------------------------------------------------------------------------" << endl;
 	}
 	}
 	exit(0);
 	exit(0);
       } else {
       } else {