From: Mikko Rasa Date: Sun, 7 Aug 2011 08:45:44 +0000 (+0300) Subject: Don't let exceptions from the socket fall out of Client::data_available X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=43b734260a10ccc5429d0ead16fac9ad0452a954;p=libs%2Fnet.git Don't let exceptions from the socket fall out of Client::data_available --- diff --git a/source/client.cpp b/source/client.cpp index 6801ad2..7e4ffb3 100644 --- a/source/client.cpp +++ b/source/client.cpp @@ -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)