Commit faefbd74 authored by Jeroen Vreeken's avatar Jeroen Vreeken
Browse files

Send log status to new clients.

parent 8cac0363
...@@ -169,11 +169,23 @@ int main (int argc, char **argv) ...@@ -169,11 +169,23 @@ int main (int argc, char **argv)
fdnew = tcp_accept(fd_listen); fdnew = tcp_accept(fd_listen);
if (fdnew >= 0) { if (fdnew >= 0) {
char status[1000];
int statlen;
nr_clients++; nr_clients++;
fd_clients = realloc(fd_clients, sizeof(int)*nr_clients); fd_clients = realloc(fd_clients, sizeof(int)*nr_clients);
fd_clients[nr_clients-1] = fdnew; fd_clients[nr_clients-1] = fdnew;
ioctl(fdnew, FIONBIO, &(int){ 1 }); ioctl(fdnew, FIONBIO, &(int){ 1 });
printf("New client. (now at %d)\n", nr_clients); printf("New client. (now at %d)\n", nr_clients);
if (fd_log >= 0) {
statlen = sprintf(status,
"New connection to proxy, controller conection is established.\n");
} else {
statlen = sprintf(status,
"New connection to proxy, no connection to controller.\n");
}
write(fdnew, status, statlen);
} }
if (rb > 0) { if (rb > 0) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment