Make server ignore if client closed connection
This commit is contained in:
parent
68f5fd5f7c
commit
c57ba8d2ec
1 changed files with 11 additions and 2 deletions
|
@ -69,10 +69,12 @@ int authenticate_client(int clientfd, uint8_t *username)
|
|||
return ZSM_STA_SUCCESS;
|
||||
}
|
||||
failure:;
|
||||
/*
|
||||
packet_t *error_pkt = create_packet(ZSM_STA_UNAUTHORISED, ZSM_TYP_ERROR,
|
||||
0, NULL, create_signature(NULL, 0, NULL));
|
||||
send_packet(error_pkt, clientfd);
|
||||
free_packet(error_pkt);
|
||||
*/
|
||||
close(clientfd);
|
||||
return ZSM_STA_ERROR_AUTHENTICATE;
|
||||
}
|
||||
|
@ -124,9 +126,16 @@ void *thread_worker(void *arg)
|
|||
if (events[i].events & EPOLLIN) {
|
||||
/* Handle packet */
|
||||
packet_t pkt;
|
||||
if (verify_packet(&pkt, client->fd) == 0) {
|
||||
int status = verify_packet(&pkt, client->fd);
|
||||
if (status != ZSM_STA_SUCCESS) {
|
||||
if (status == ZSM_STA_CLOSED_CONNECTION) {
|
||||
/* TODO: Remove client from thread */
|
||||
error(0, "Client closed connection");
|
||||
} else {
|
||||
error(0, "Error verifying packet");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Message relay */
|
||||
uint8_t to[MAX_NAME];
|
||||
|
|
Loading…
Reference in a new issue