fixed buffer not empty
This commit is contained in:
parent
49b4daae83
commit
e0501259a7
@ -190,7 +190,7 @@ void *clientCommunication(void *data)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string incomplete_message;
|
std::string incomplete_message = "";
|
||||||
|
|
||||||
do {
|
do {
|
||||||
size = recv(*current_socket, buffer, BUF - 1, 0);
|
size = recv(*current_socket, buffer, BUF - 1, 0);
|
||||||
@ -267,11 +267,13 @@ void *clientCommunication(void *data)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (send(*current_socket, "OK", 3, 0) == -1) {
|
if (send(*current_socket, "OK\n", 3, 0) == -1) {
|
||||||
perror("send answer failed");
|
perror("send answer failed");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
incomplete_message.clear();
|
||||||
|
|
||||||
} while (strcmp(buffer, "quit") != 0 && !abortRequested);
|
} while (strcmp(buffer, "quit") != 0 && !abortRequested);
|
||||||
|
|
||||||
// closes/frees the descriptor if not already
|
// closes/frees the descriptor if not already
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user