aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--snowcast_server.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/snowcast_server.c b/snowcast_server.c
index e8f9525..b1d7d8a 100644
--- a/snowcast_server.c
+++ b/snowcast_server.c
@@ -170,7 +170,7 @@ int main(int argc, char *argv[])
printf("TODO: set station to %d\n", ntohs(command.number));
}
else {
- // send back ianinvalid command
+ // send back in invalid command
struct InvalidCommand invalid;
invalid.replyType = 4;
invalid.replyStringSize = 21;
@@ -178,18 +178,11 @@ int main(int argc, char *argv[])
invalid.replyString = "Invalid command type";
if ((send(i, &invalid, sizeof(struct InvalidCommand), 0)) == -1)
perror("send");
+
+ // drop connection upon invalid command
+ close(i);
+ FD_CLR(i, &master);
}
- // for(j = 0; j <= fdmax; j++) {
- // // send to everyone!
- // if (FD_ISSET(j, &master)) {
- // // except the listener and ourselves
- // if (j != listener && j != i) {
- // if (send(j, buf, nbytes, 0) == -1) {
- // perror("send");
- // }
- // }
- // }
- // }
}
} // END handle data from client
} // END got new incoming connection