rxpd_connection_cmd_SHUTDOWN (int fd, short event, void* ptr)
{
struct rxpd_connection* self = (struct rxpd_connection*) ptr;
- rxpd_buffer_printf (&self->out, "#ERROR: unimplemented command %s\n", &__func__[20]);
+ // destroy all sockets
+ LLIST_WHILE_HEAD (&self->base->sockets_pending, n)
+ {
+ struct rxpd_socket* socket = (struct rxpd_socket*)n;
+ rxpd_socket_delete (socket);
+ }
+ LLIST_WHILE_HEAD (&self->base->sockets_active, n)
+ {
+ struct rxpd_socket* socket = (struct rxpd_socket*)n;
+ rxpd_socket_delete (socket);
+ }
+
+ rxpd_buffer_printf (&self->out, "#OK:\n");
+ close (fd);
}