From dea314b92324ad67455bb039e2078652ab0e5824 Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Fri, 5 Dec 2003 14:56:24 +0000 Subject: [PATCH] Se agrega un try para tratar de solucionar situaciones en las que el server recibe un SIGPIPE (cuando un cliente se desconecta). --- Server/src/controlserver.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Server/src/controlserver.cpp b/Server/src/controlserver.cpp index 966e362..a8baf50 100644 --- a/Server/src/controlserver.cpp +++ b/Server/src/controlserver.cpp @@ -96,7 +96,19 @@ void ControlServer::real_run(void) throw() { } void ControlServer::send(const Response& response) { - socket << response << flush; + try { + socket << response << flush; + } catch (const sockerr& e) { + cerr << __FILE__ << "(" << __LINE__ << ") send(): " + << "Socket Error: " << e.operation() << " | serrno = " + << e.serrno() << " | errstr = " << e.errstr() << endl; + } catch (const exception& e) { + cerr << __FILE__ << "(" << __LINE__ << ") send(): " + << "Error: " << e.what() << endl; + } catch (...) { + cerr << __FILE__ << "(" << __LINE__ << ") send(): " + << "Error DESCONOCIDO!!!!!!!!" << endl; + } #ifdef DEBUG cerr << __FILE__ << "(" << __LINE__ << ")" << ": send() Enviado!" << endl; -- 2.43.0