summaryrefslogtreecommitdiff
path: root/src/SocketBuffer.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2010-02-15 13:02:14 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2010-02-15 13:02:14 +0000
commit3842161f9b5ae0c35b0b4fff7ebab661e685ef93 (patch)
treed71d0cd4d24464746c80f488d4c6d2085d5538ea /src/SocketBuffer.cc
parenta6a174a0b24fccf0bf5cbd4e68cc52feee813659 (diff)
2010-02-15 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Removed ret == 0 checking for SSL_read(), SSL_write() and SSL_peek() because the checks are done in the caller. In SocketBuffer::send(), throw exception if nothing could be written and socket error was not EWOULDBLOCK * src/SocketBuffer.cc * src/SocketCore.cc
Diffstat (limited to 'src/SocketBuffer.cc')
-rw-r--r--src/SocketBuffer.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/SocketBuffer.cc b/src/SocketBuffer.cc
index 4797a1e1..447b1f69 100644
--- a/src/SocketBuffer.cc
+++ b/src/SocketBuffer.cc
@@ -33,9 +33,14 @@
*/
/* copyright --> */
#include "SocketBuffer.h"
-#include "SocketCore.h"
+
#include <cassert>
+#include "SocketCore.h"
+#include "DlAbortEx.h"
+#include "message.h"
+#include "StringFormat.h"
+
namespace aria2 {
SocketBuffer::SocketBuffer(const SharedHandle<SocketCore>& socket):
@@ -61,6 +66,9 @@ ssize_t SocketBuffer::send()
}
ssize_t len = _socket->writeData(_sendbuf.c_str(),
_sendbuf.size());
+ if(len == 0 && !_socket->wantRead() && !_socket->wantWrite()) {
+ throw DL_ABORT_EX(StringFormat(EX_SOCKET_SEND, "Connection closed.").str());
+ }
_sendbuf.erase(0, len);
return len;
}