Commit 198865b0 authored by Andreas Kempe's avatar Andreas Kempe

Added network error messages to the render server.

parent bba2fd8c
......@@ -18,6 +18,9 @@ mandel_render_srv::mandel_render_srv(mandel_settings settings, std::string host,
{
socket = new mandel_socket(host.c_str(), port, this);
connect(socket, &mandel_socket::packet_ready, this, &mandel_render_srv::handle_recv_data);
connect(socket, &mandel_socket::disconnected, this, &mandel_render_srv::handle_network_down);
connect(socket, static_cast<void (mandel_socket::*)(QAbstractSocket::SocketError)>(&mandel_socket::error),
this, &mandel_render_srv::handle_socket_error);
}
else
socket = nullptr;
......@@ -106,3 +109,15 @@ void mandel_render_srv::handle_recv_data()
delete packet;
}
void mandel_render_srv::handle_network_down()
{
cout << "The network connection died! Shutting down!" << endl;
exit(1);
}
void mandel_render_srv::handle_socket_error(QAbstractSocket::SocketError error)
{
cout << "Socket error: " << socket->errorString().toStdString() << ", Shutting down!" << endl;
exit(1);
}
......@@ -23,6 +23,8 @@ class mandel_render_srv : public QObject
private slots:
void handle_recv_data();
void handle_network_down();
void handle_socket_error(QAbstractSocket::SocketError error);
};
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment