Commit 59688a92 authored by Ilya Lipnitskiy's avatar Ilya Lipnitskiy

protobuf-c-rpc/protobuf-c-rpc.c: free the timer created by autoreconnect

in case the client has failed to connect and got destroyed (fixes #70)

protobuf-c-rpc/t/test-rpc.c: add a test case for #70
parent 5d743332
......@@ -704,6 +704,7 @@ destroy_client_rpc (ProtobufCService *service)
break;
case PROTOBUF_C_CLIENT_STATE_FAILED_WAITING:
protobuf_c_dispatch_remove_timer (client->info.failed_waiting.timer);
client->allocator->free (client->allocator, client->info.failed_waiting.timer);
client->allocator->free (client->allocator, client->info.failed_waiting.error_message);
break;
case PROTOBUF_C_CLIENT_STATE_FAILED:
......
......@@ -182,6 +182,18 @@ pretend_we_are_in_another_thread (ProtobufC_RPC_Server *server,
return 0; /* indicate we are NOT in RPC thread */
}
static void test_client_create_destroy (void)
{
ProtobufCService *rpc_service =
protobuf_c_rpc_client_new(PROTOBUF_C_RPC_ADDRESS_LOCAL, "test.socket", NULL, NULL);
protobuf_c_dispatch_run(protobuf_c_dispatch_default());
rpc_service->destroy(rpc_service);
protobuf_c_dispatch_destroy_default();
}
int main()
{
protobuf_c_boolean is_done;
......@@ -285,6 +297,9 @@ int main()
protobuf_c_dispatch_destroy_default ();
message ("creating and destroying a client");
test_client_create_destroy();
return 0;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment