mirror of
https://github.com/protobuf-c/protobuf-c.git
synced 2024-12-29 07:19:42 +08:00
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
This commit is contained in:
parent
5d74333219
commit
59688a92b3
@ -704,6 +704,7 @@ destroy_client_rpc (ProtobufCService *service)
|
|||||||
break;
|
break;
|
||||||
case PROTOBUF_C_CLIENT_STATE_FAILED_WAITING:
|
case PROTOBUF_C_CLIENT_STATE_FAILED_WAITING:
|
||||||
protobuf_c_dispatch_remove_timer (client->info.failed_waiting.timer);
|
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);
|
client->allocator->free (client->allocator, client->info.failed_waiting.error_message);
|
||||||
break;
|
break;
|
||||||
case PROTOBUF_C_CLIENT_STATE_FAILED:
|
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 */
|
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()
|
int main()
|
||||||
{
|
{
|
||||||
protobuf_c_boolean is_done;
|
protobuf_c_boolean is_done;
|
||||||
@ -285,6 +297,9 @@ int main()
|
|||||||
|
|
||||||
protobuf_c_dispatch_destroy_default ();
|
protobuf_c_dispatch_destroy_default ();
|
||||||
|
|
||||||
|
message ("creating and destroying a client");
|
||||||
|
test_client_create_destroy();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user