whitelist: Read multiple commands until client closes connection

This restores the same behavior we had before e11c02c8, and fixes the whitelist
add/remove-from command.
This commit is contained in:
Martin Willi
2013-10-29 14:22:52 +01:00
parent 348b9d82b4
commit d402e87d16
@@ -99,11 +99,8 @@ static bool on_accept(private_whitelist_control_t *this, stream_t *stream)
identification_t *id; identification_t *id;
whitelist_msg_t msg; whitelist_msg_t msg;
if (!stream->read_all(stream, &msg, sizeof(msg))) while (stream->read_all(stream, &msg, sizeof(msg)))
{ {
return FALSE;
}
msg.id[sizeof(msg.id) - 1] = 0; msg.id[sizeof(msg.id) - 1] = 0;
id = identification_create_from_string(msg.id); id = identification_create_from_string(msg.id);
switch (ntohl(msg.type)) switch (ntohl(msg.type))
@@ -131,6 +128,7 @@ static bool on_accept(private_whitelist_control_t *this, stream_t *stream)
break; break;
} }
id->destroy(id); id->destroy(id);
}
return FALSE; return FALSE;
} }