]> git.tdb.fi Git - libs/net.git/commitdiff
Don't let exceptions from the socket fall out of Client::data_available
authorMikko Rasa <tdb@tdb.fi>
Sun, 7 Aug 2011 08:45:44 +0000 (11:45 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sun, 7 Aug 2011 08:46:28 +0000 (11:46 +0300)
source/client.cpp

index 6801ad2a3fc73cae566170577ad03b20f0182dc3..7e4ffb39e936e63d08394fe322dc2824318df755 100644 (file)
@@ -122,7 +122,19 @@ void Client::connect_finished(int err)
 void Client::data_available()
 {
        char rbuf[4096];
-       unsigned len = sock->read(rbuf, sizeof(rbuf));
+       unsigned len;
+       try
+       {
+               len = sock->read(rbuf, sizeof(rbuf));
+       }
+       catch(const SystemError &e)
+       {
+               signal_socket_error.emit(e.get_error_code());
+               return;
+       }
+
+       if(!len)
+               return;
        in_buf.append(rbuf, len);
 
        if(!response)