mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-24 23:23:03 +01:00
Finalized the remote cleanup by Dmitry Kovalenko.
This commit is contained in:
parent
d42ed19e80
commit
0f776b2517
@ -313,7 +313,6 @@ static bool select_wait(rem_port*, slct_t*);
|
|||||||
static int send_full(rem_port*, PACKET *);
|
static int send_full(rem_port*, PACKET *);
|
||||||
static int send_partial(rem_port*, PACKET *);
|
static int send_partial(rem_port*, PACKET *);
|
||||||
|
|
||||||
static void unhook_port(rem_port*, rem_port*);
|
|
||||||
static int xdrinet_create(XDR*, rem_port*, UCHAR *, USHORT, enum xdr_op);
|
static int xdrinet_create(XDR*, rem_port*, UCHAR *, USHORT, enum xdr_op);
|
||||||
static bool setNoNagleOption(rem_port*);
|
static bool setNoNagleOption(rem_port*);
|
||||||
static FPTR_INT tryStopMainThread = 0;
|
static FPTR_INT tryStopMainThread = 0;
|
||||||
@ -582,7 +581,7 @@ rem_port* INET_connect(const TEXT* name,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
rem_port* port = alloc_port(0);
|
rem_port* port = alloc_port(NULL);
|
||||||
port->port_status_vector = status_vector;
|
port->port_status_vector = status_vector;
|
||||||
REMOTE_get_timeout_params(port, dpb);
|
REMOTE_get_timeout_params(port, dpb);
|
||||||
status_vector[0] = isc_arg_gds;
|
status_vector[0] = isc_arg_gds;
|
||||||
@ -936,7 +935,7 @@ rem_port* INET_reconnect(HANDLE handle, ISC_STATUS* status_vector)
|
|||||||
* a port block.
|
* a port block.
|
||||||
*
|
*
|
||||||
**************************************/
|
**************************************/
|
||||||
rem_port* port = alloc_port(0);
|
rem_port* port = alloc_port(NULL);
|
||||||
port->port_status_vector = status_vector;
|
port->port_status_vector = status_vector;
|
||||||
status_vector[0] = isc_arg_gds;
|
status_vector[0] = isc_arg_gds;
|
||||||
status_vector[1] = 0;
|
status_vector[1] = 0;
|
||||||
@ -974,7 +973,7 @@ rem_port* INET_server(int sock)
|
|||||||
*
|
*
|
||||||
**************************************/
|
**************************************/
|
||||||
int n = 0;
|
int n = 0;
|
||||||
rem_port* port = alloc_port(0);
|
rem_port* port = alloc_port(NULL);
|
||||||
port->port_flags |= PORT_server;
|
port->port_flags |= PORT_server;
|
||||||
port->port_server_flags |= SRVR_server;
|
port->port_server_flags |= SRVR_server;
|
||||||
port->port_handle = (HANDLE) sock;
|
port->port_handle = (HANDLE) sock;
|
||||||
@ -1133,7 +1132,7 @@ static bool accept_connection(rem_port* port, const P_CNCT* cnct)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static rem_port* alloc_port( rem_port* parent)
|
static rem_port* alloc_port(rem_port* const parent)
|
||||||
{
|
{
|
||||||
/**************************************
|
/**************************************
|
||||||
*
|
*
|
||||||
@ -1443,7 +1442,7 @@ static THREAD_ENTRY_DECLARE waitThread(THREAD_ENTRY_PARAM)
|
|||||||
}
|
}
|
||||||
#endif // !defined(WIN_NT)
|
#endif // !defined(WIN_NT)
|
||||||
|
|
||||||
static void disconnect( rem_port* port)
|
static void disconnect(rem_port* const port)
|
||||||
{
|
{
|
||||||
/**************************************
|
/**************************************
|
||||||
*
|
*
|
||||||
@ -1484,7 +1483,6 @@ static void disconnect( rem_port* port)
|
|||||||
|
|
||||||
#endif // WIN_NT
|
#endif // WIN_NT
|
||||||
|
|
||||||
// If this is a sub-port, unlink it from it's parent
|
|
||||||
Firebird::MutexLockGuard guard(port_mutex);
|
Firebird::MutexLockGuard guard(port_mutex);
|
||||||
port->port_state = rem_port::DISCONNECTED;
|
port->port_state = rem_port::DISCONNECTED;
|
||||||
|
|
||||||
@ -1493,10 +1491,8 @@ static void disconnect( rem_port* port)
|
|||||||
port->port_async = NULL;
|
port->port_async = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
rem_port* parent = port->port_parent;
|
// If this is a sub-port, unlink it from it's parent
|
||||||
if (parent != NULL) {
|
port->unlinkParent();
|
||||||
unhook_port(port, parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
inet_ports->unRegisterPort(port);
|
inet_ports->unRegisterPort(port);
|
||||||
|
|
||||||
@ -3161,32 +3157,6 @@ static bool packet_send( rem_port* port, const SCHAR* buffer, SSHORT buffer_leng
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void unhook_port( rem_port* port, rem_port* parent)
|
|
||||||
{
|
|
||||||
/**************************************
|
|
||||||
*
|
|
||||||
* u n h o o k _ p a r e n t
|
|
||||||
*
|
|
||||||
**************************************
|
|
||||||
*
|
|
||||||
* Functional description
|
|
||||||
* Disconnect a port from its parent
|
|
||||||
* This must be done under port_mutex control.
|
|
||||||
*
|
|
||||||
**************************************/
|
|
||||||
|
|
||||||
for (rem_port** ptr = &parent->port_clients; *ptr; ptr = &(*ptr)->port_next)
|
|
||||||
{
|
|
||||||
if (*ptr == port) {
|
|
||||||
*ptr = port->port_next;
|
|
||||||
if (ptr == &parent->port_clients) {
|
|
||||||
parent->port_next = *ptr;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool setNoNagleOption(rem_port* port)
|
static bool setNoNagleOption(rem_port* port)
|
||||||
{
|
{
|
||||||
/**************************************
|
/**************************************
|
||||||
|
@ -799,12 +799,7 @@ static void disconnect(rem_port* port)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If this is a sub-port, unlink it from its parent
|
// If this is a sub-port, unlink it from its parent
|
||||||
|
|
||||||
rem_port* const parent = port->port_parent;
|
|
||||||
if (parent)
|
|
||||||
{
|
|
||||||
port->unlinkParent();
|
port->unlinkParent();
|
||||||
}
|
|
||||||
|
|
||||||
if (port->port_server_flags & SRVR_server)
|
if (port->port_server_flags & SRVR_server)
|
||||||
{
|
{
|
||||||
|
@ -618,12 +618,13 @@ static void cleanup_memory(void* /*block*/)
|
|||||||
void rem_port::linkParent(rem_port* const parent)
|
void rem_port::linkParent(rem_port* const parent)
|
||||||
{
|
{
|
||||||
fb_assert(parent);
|
fb_assert(parent);
|
||||||
|
fb_assert(this->port_parent == NULL);
|
||||||
|
|
||||||
port_parent = parent;
|
this->port_parent = parent;
|
||||||
port_next = parent->port_clients;
|
this->port_next = parent->port_clients;
|
||||||
port_handle = parent->port_handle;
|
this->port_handle = parent->port_handle;
|
||||||
port_server = parent->port_server;
|
this->port_server = parent->port_server;
|
||||||
port_server_flags = parent->port_server_flags;
|
this->port_server_flags = parent->port_server_flags;
|
||||||
|
|
||||||
parent->port_clients = parent->port_next = this;
|
parent->port_clients = parent->port_next = this;
|
||||||
}
|
}
|
||||||
@ -635,7 +636,7 @@ void rem_port::unlinkParent()
|
|||||||
if (this->port_parent == NULL)
|
if (this->port_parent == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#if DEV_BUILD
|
#ifdef DEV_BUILD
|
||||||
bool found = false;
|
bool found = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -652,7 +653,7 @@ void rem_port::unlinkParent()
|
|||||||
this->port_parent->port_next = *ptr;
|
this->port_parent->port_next = *ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if DEV_BUILD
|
#ifdef DEV_BUILD
|
||||||
found = true;
|
found = true;
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
@ -1320,7 +1320,7 @@ static rem_port* connect_client(PACKET* packet, ISC_STATUS* status_vector)
|
|||||||
UCHAR* const channel_s2c_client_ptr = start_ptr + avail;
|
UCHAR* const channel_s2c_client_ptr = start_ptr + avail;
|
||||||
|
|
||||||
rem_port* port =
|
rem_port* port =
|
||||||
alloc_port(0,
|
alloc_port(NULL,
|
||||||
channel_c2s_client_ptr,
|
channel_c2s_client_ptr,
|
||||||
xcc->xcc_send_channel->xch_size,
|
xcc->xcc_send_channel->xch_size,
|
||||||
channel_s2c_client_ptr,
|
channel_s2c_client_ptr,
|
||||||
@ -1468,17 +1468,13 @@ static void disconnect(rem_port* port)
|
|||||||
*
|
*
|
||||||
**************************************/
|
**************************************/
|
||||||
|
|
||||||
// If this is a sub-port, unlink it from it's parent
|
|
||||||
|
|
||||||
if (port->port_async) {
|
if (port->port_async) {
|
||||||
disconnect(port->port_async);
|
disconnect(port->port_async);
|
||||||
port->port_async = NULL;
|
port->port_async = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
rem_port* const parent = port->port_parent;
|
// If this is a sub-port, unlink it from it's parent
|
||||||
if (parent != NULL) {
|
|
||||||
port->unlinkParent();
|
port->unlinkParent();
|
||||||
}
|
|
||||||
|
|
||||||
if (port->port_flags & PORT_server)
|
if (port->port_flags & PORT_server)
|
||||||
xnet_ports->unRegisterPort(port);
|
xnet_ports->unRegisterPort(port);
|
||||||
@ -2601,7 +2597,7 @@ static rem_port* get_server_port(ULONG client_pid,
|
|||||||
|
|
||||||
// finally, allocate and set the port structure for this client
|
// finally, allocate and set the port structure for this client
|
||||||
|
|
||||||
port = alloc_port(0,
|
port = alloc_port(NULL,
|
||||||
channel_s2c_data_buffer,
|
channel_s2c_data_buffer,
|
||||||
xcc->xcc_send_channel->xch_size,
|
xcc->xcc_send_channel->xch_size,
|
||||||
channel_c2s_data_buffer,
|
channel_c2s_data_buffer,
|
||||||
|
Loading…
Reference in New Issue
Block a user