void test_control_connection(gsize transaction_size) { moc_connection = (ControlConnectionMoc *)control_connection_moc_new(&moc_server); g_string_assign(moc_connection->source_buffer->buffer,"test command\n"); moc_connection->transaction_size = transaction_size; control_connection_start_watches((ControlConnection *)moc_connection); assert_string(result_string->str, "OK\n.\n", "BAD Behaviour transaction_size: %d",transaction_size); }
void setup(void) { msg_init(FALSE); main_loop_register_control_commands(NULL); stats_register_control_commands(); control_server = control_server_dummy_new(); control_connection = control_connection_dummy_new(control_server); control_connection_start_watches(control_connection); }
ControlConnection * control_connection_new(gint sock) { ControlConnection *self = g_new0(ControlConnection, 1); self->output_buffer = g_string_sized_new(256); self->input_buffer = g_string_sized_new(128); control_connection_start_watches(self, sock); return self; }
ControlConnection * control_connection_new(ControlServer *server, gint sock) { ControlConnectionUnix *self = g_new0(ControlConnectionUnix, 1); control_connection_init_instance(&self->super, server); self->fd = sock; self->super.free_fn = control_connection_unix_free; self->super.read = control_connection_unix_read; self->super.write = control_connection_unix_write; control_connection_start_watches(&self->super); return &self->super; }