Close client if connection breaks.
* source/client/receiving-thread.c (receivingThreadHandler): Exit the process if the connection to the server breaks. * source/server/main.c (main): Minor formatting tweak.
This commit is contained in:
parent
0a2d03fdaa
commit
6fc2e4d2b9
|
@ -34,10 +34,16 @@ void * receivingThreadHandler(void * threadArguments)
|
|||
wattrset(gameWindow, A_NORMAL);
|
||||
|
||||
struct ServerToClientMessage currentMessage;
|
||||
int returnValue = 0;
|
||||
while (true)
|
||||
{
|
||||
gnutls_record_recv(session, ¤tMessage, sizeof(struct ServerToClientMessage));
|
||||
returnValue = gnutls_record_recv(session, ¤tMessage, sizeof(struct ServerToClientMessage));
|
||||
|
||||
if (gnutls_error_is_fatal(returnValue))
|
||||
{
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
switch (currentMessage.type)
|
||||
{
|
||||
case SYSTEM:
|
||||
|
|
|
@ -231,6 +231,7 @@ int main (int argc, char ** argv)
|
|||
gnutls_credentials_set(*tlsSession, GNUTLS_CRD_ANON, serverKey);
|
||||
gnutls_handshake_set_timeout(*tlsSession, GNUTLS_DEFAULT_HANDSHAKE_TIMEOUT);
|
||||
gnutls_handshake_set_post_client_hello_function(*tlsSession, checkRequestedHostname);
|
||||
|
||||
// Accept the connection:
|
||||
int newSocket = accept(masterSocket, NULL, NULL);
|
||||
gnutls_transport_set_int(*tlsSession, newSocket);
|
||||
|
|
Loading…
Reference in New Issue