fix: Fix array access for setting port to inactive
This commit is contained in:
parent
425062ab5c
commit
9e355db588
3
main.c
3
main.c
|
@ -1,4 +1,5 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
@ -70,7 +71,7 @@ int assign_workers(int* socket_fd) {
|
||||||
memcpy(&port, buffer+1, sizeof(u_int32_t));
|
memcpy(&port, buffer+1, sizeof(u_int32_t));
|
||||||
port = ntohl(port);
|
port = ntohl(port);
|
||||||
printf("[Host] Unassigning port %i\n", port);
|
printf("[Host] Unassigning port %i\n", port);
|
||||||
ports[11000-port] = false;
|
ports[abs(11000-port)] = false;
|
||||||
shutdown(client_sock, SHUT_RDWR);
|
shutdown(client_sock, SHUT_RDWR);
|
||||||
close(client_sock);
|
close(client_sock);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue