8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 23:23:04 +01:00

Link port into parent's list only after it full creation.

Not used currently in XNET\WNET but looks better ;)
This commit is contained in:
hvlad 2008-03-21 14:52:10 +00:00
parent 9d97d10ddc
commit d90529cd7d
2 changed files with 28 additions and 25 deletions

View File

@ -558,19 +558,6 @@ static rem_port* alloc_port( rem_port* parent)
sprintf(buffer, "WNet (%s)", port->port_host->str_data); sprintf(buffer, "WNet (%s)", port->port_host->str_data);
port->port_version = REMOTE_make_string(buffer); port->port_version = REMOTE_make_string(buffer);
if (parent) {
port->port_parent = parent;
port->port_next = parent->port_clients;
parent->port_clients = parent->port_next = port;
port->port_handle = parent->port_handle;
port->port_server = parent->port_server;
port->port_server_flags = parent->port_server_flags;
if (port->port_connection)
ALLR_free(port->port_connection);
port->port_connection =
REMOTE_make_string(parent->port_connection->str_data);
}
port->port_accept = accept_connection; port->port_accept = accept_connection;
port->port_disconnect = disconnect; port->port_disconnect = disconnect;
port->port_receive_packet = receive; port->port_receive_packet = receive;
@ -593,6 +580,20 @@ static rem_port* alloc_port( rem_port* parent)
xdrwnet_create(&port->port_receive, port, port->port_buffer, 0, xdrwnet_create(&port->port_receive, port, port->port_buffer, 0,
XDR_DECODE); XDR_DECODE);
if (parent)
{
port->port_parent = parent;
port->port_next = parent->port_clients;
parent->port_clients = parent->port_next = port;
port->port_handle = parent->port_handle;
port->port_server = parent->port_server;
port->port_server_flags = parent->port_server_flags;
if (port->port_connection){
ALLR_free(port->port_connection);
}
port->port_connection = REMOTE_make_string(parent->port_connection->str_data);
}
return port; return port;
} }

View File

@ -626,18 +626,6 @@ static rem_port* alloc_port(rem_port* parent,
port->port_connection = REMOTE_make_string(buffer); port->port_connection = REMOTE_make_string(buffer);
fb_utils::snprintf(buffer, sizeof(buffer), "XNet (%s)", port->port_host->str_data); fb_utils::snprintf(buffer, sizeof(buffer), "XNet (%s)", port->port_host->str_data);
port->port_version = REMOTE_make_string(buffer); port->port_version = REMOTE_make_string(buffer);
if (parent) {
port->port_parent = parent;
port->port_next = parent->port_clients;
parent->port_clients = parent->port_next = port;
port->port_handle = parent->port_handle;
port->port_server = parent->port_server;
port->port_server_flags = parent->port_server_flags;
if (port->port_connection)
ALLR_free(port->port_connection);
port->port_connection =
REMOTE_make_string(parent->port_connection->str_data);
}
port->port_accept = accept_connection; port->port_accept = accept_connection;
port->port_disconnect = disconnect; port->port_disconnect = disconnect;
@ -659,6 +647,20 @@ static rem_port* alloc_port(rem_port* parent,
xdrxnet_create(&port->port_send, port, send_buffer, send_length, XDR_ENCODE); xdrxnet_create(&port->port_send, port, send_buffer, send_length, XDR_ENCODE);
xdrxnet_create(&port->port_receive, port, receive_buffer, 0, XDR_DECODE); xdrxnet_create(&port->port_receive, port, receive_buffer, 0, XDR_DECODE);
if (parent)
{
port->port_parent = parent;
port->port_next = parent->port_clients;
parent->port_clients = parent->port_next = port;
port->port_handle = parent->port_handle;
port->port_server = parent->port_server;
port->port_server_flags = parent->port_server_flags;
if (port->port_connection) {
ALLR_free(port->port_connection);
}
port->port_connection = REMOTE_make_string(parent->port_connection->str_data);
}
return port; return port;
} }