mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-27 11:06:50 +01:00
improved EchoServer error handling
This commit is contained in:
@@ -110,6 +110,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void onSocketReadable(const AutoPtr<ReadableNotification>& pNf)
|
void onSocketReadable(const AutoPtr<ReadableNotification>& pNf)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
int len = _socket.receiveBytes(_fifoIn);
|
int len = _socket.receiveBytes(_fifoIn);
|
||||||
if (len > 0)
|
if (len > 0)
|
||||||
@@ -121,11 +123,27 @@ public:
|
|||||||
delete this;
|
delete this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Poco::Exception& exc)
|
||||||
|
{
|
||||||
|
Application& app = Application::instance();
|
||||||
|
app.logger().log(exc);
|
||||||
|
delete this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void onSocketWritable(const AutoPtr<WritableNotification>& pNf)
|
void onSocketWritable(const AutoPtr<WritableNotification>& pNf)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
_socket.sendBytes(_fifoOut);
|
_socket.sendBytes(_fifoOut);
|
||||||
}
|
}
|
||||||
|
catch (Poco::Exception& exc)
|
||||||
|
{
|
||||||
|
Application& app = Application::instance();
|
||||||
|
app.logger().log(exc);
|
||||||
|
delete this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void onSocketShutdown(const AutoPtr<ShutdownNotification>& pNf)
|
void onSocketShutdown(const AutoPtr<ShutdownNotification>& pNf)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user