client_socket was being accidentally reset to -1

That was making the telnet debug server to crash, so fortunately that
solved it while also having the neat features from dynstr.
This commit is contained in:
Xavier Del Campo Romero 2020-05-22 00:50:18 +02:00
parent da7b01b26d
commit 004a305458
2 changed files with 21 additions and 6 deletions

View File

@ -395,7 +395,16 @@ void DebugVSync() {
return;
}
client_socket = GetClient(server_socket);
if (client_socket < 1)
{
client_socket = GetClient(server_socket);
if (client_socket > 0)
{
DebugHello();
}
}
ProcessCommands();
}
@ -466,7 +475,17 @@ void ProcessDebug() {
}
}
while (paused) {
client_socket = GetClient(server_socket);
if (client_socket < 1)
{
client_socket = GetClient(server_socket);
if (client_socket > 0)
{
DebugHello();
}
}
ProcessCommands();
GPU_updateLace();
SysUpdate();
@ -497,7 +516,6 @@ static void ProcessCommands() {
case READ_SOCKET_SHUTDOWN:
/* Fall through. */
default:
perror("recv() error");
return;
}

View File

@ -157,15 +157,12 @@ static enum read_socket_err ReadSocketOS(int client_socket, char *buf, size_t *c
switch (res)
{
case -1:
fprintf(stderr, "READ_SOCKET_ERR_RECV, recv(%d, %p, %zu, %d)\n", client_socket, buf, *len, 0);
return READ_SOCKET_ERR_RECV;
case 0:
fprintf(stderr, "READ_SOCKET_SHUTDOWN\n");
return READ_SOCKET_SHUTDOWN;
default:
printf("received %zu/%zu bytes\n", res, *len);
*len = res;
break;
}