8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-02-02 10:40:38 +01:00

CORE-6004

Don't assign new socket handle before socket is connected
This commit is contained in:
KarloX2 2019-02-22 07:15:08 +01:00
parent 81b0e07ad4
commit 83811547c9

View File

@ -1492,11 +1492,10 @@ static rem_port* aux_connect(rem_port* port, PACKET* packet)
port->auxAcceptError(packet);
inet_error(false, port, "socket", isc_net_event_connect_err, savedError);
}
new_port->port_handle = n;
int optval = 1;
setsockopt(n, SOL_SOCKET, SO_KEEPALIVE, (SCHAR*) &optval, sizeof(optval));
setFastLoopbackOption(new_port);
setFastLoopbackOption(new_port, n);
status = address.connect(n);
if (status < 0)
@ -1507,6 +1506,7 @@ static rem_port* aux_connect(rem_port* port, PACKET* packet)
inet_error(false, port, "connect", isc_net_event_connect_err, savedError);
}
new_port->port_handle = n;
new_port->port_peer_name = port->port_peer_name;
get_peer_info(new_port);