- logger(LOG_DEBUG, _("Malformed control command received"));
- res.res_errno = EINVAL;
-
-respond:
- res.length = (sizeof res)
- + ((res_data == NULL) ? 0 : EVBUFFER_LENGTH(res_data));
- evbuffer_drain(event->input, req.length);
- if(bufferevent_write(event, &res, sizeof res) == -1)
- goto failure;
- if(res_data != NULL) {
- if(bufferevent_write_buffer(event, res_data) == -1)
- goto failure;
- evbuffer_free(res_data);
+ case REQ_RELOAD:
+ logger(DEBUG_ALWAYS, LOG_NOTICE, "Got '%s' command", "reload");
+ int result = reload_configuration();
+ return control_return(c, REQ_RELOAD, result);
+
+ case REQ_DISCONNECT: {
+ char name[MAX_STRING_SIZE];
+ bool found = false;
+
+ if(sscanf(request, "%*d %*d " MAX_STRING, name) != 1) {
+ return control_return(c, REQ_DISCONNECT, -1);
+ }
+
+ for list_each(connection_t, other, connection_list) {
+ if(strcmp(other->name, name)) {
+ continue;
+ }
+
+ terminate_connection(other, other->edge);
+ found = true;
+ }
+
+ return control_return(c, REQ_DISCONNECT, found ? 0 : -2);