Commit fd6ce140 authored by lahiker42's avatar lahiker42

Bugs with making TCP connections.


git-svn-id: https://protobuf-c.googlecode.com/svn/trunk@170 00440858-1255-0410-a3e6-75ea37f81c3a
parent 2ace60a2
...@@ -284,7 +284,7 @@ begin_connecting (ProtobufC_RPC_Client *client, ...@@ -284,7 +284,7 @@ begin_connecting (ProtobufC_RPC_Client *client,
protobuf_c_assert (client->state == PROTOBUF_C_CLIENT_STATE_NAME_LOOKUP); protobuf_c_assert (client->state == PROTOBUF_C_CLIENT_STATE_NAME_LOOKUP);
client->state = PROTOBUF_C_CLIENT_STATE_CONNECTING; client->state = PROTOBUF_C_CLIENT_STATE_CONNECTING;
client->fd = socket (PF_UNIX, SOCK_STREAM, 0); client->fd = socket (address->sa_family, SOCK_STREAM, 0);
if (client->fd < 0) if (client->fd < 0)
{ {
client_failed (client, "error creating socket: %s", strerror (errno)); client_failed (client, "error creating socket: %s", strerror (errno));
...@@ -325,7 +325,8 @@ handle_name_lookup_success (const uint8_t *address, ...@@ -325,7 +325,8 @@ handle_name_lookup_success (const uint8_t *address,
destroy_client_rpc (&client->base_service); destroy_client_rpc (&client->base_service);
return; return;
} }
addr.sin_family = PF_INET; memset (&addr, 0, sizeof (addr));
addr.sin_family = AF_INET;
memcpy (&addr.sin_addr, address, 4); memcpy (&addr.sin_addr, address, 4);
addr.sin_port = htons (client->info.name_lookup.port); addr.sin_port = htons (client->info.name_lookup.port);
begin_connecting (client, (struct sockaddr *) &addr, sizeof (addr)); begin_connecting (client, (struct sockaddr *) &addr, sizeof (addr));
...@@ -1279,7 +1280,7 @@ protobuf_c_rpc_server_new (ProtobufC_RPC_AddressType type, ...@@ -1279,7 +1280,7 @@ protobuf_c_rpc_server_new (ProtobufC_RPC_AddressType type,
address_len); address_len);
break; break;
case PROTOBUF_C_RPC_ADDRESS_TCP: case PROTOBUF_C_RPC_ADDRESS_TCP:
protocol_family = PF_UNIX; protocol_family = PF_INET;
memset (&addr_in, 0, sizeof (addr_in)); memset (&addr_in, 0, sizeof (addr_in));
addr_in.sin_family = AF_INET; addr_in.sin_family = AF_INET;
{ {
......
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