mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-24 04:03:03 +01:00
Backported CORE-6348: Wire compression causes freezes
This commit is contained in:
parent
db14b155e6
commit
6fe8d15b05
@ -280,12 +280,30 @@ public:
|
||||
{
|
||||
slct_main = port;
|
||||
slct_port = port;
|
||||
#ifdef WIRE_COMPRESS_SUPPORT
|
||||
slct_zport = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
// get port to check for readyness
|
||||
// assume port_mutex is locked
|
||||
HandleState checkNext(RemPortPtr& port)
|
||||
{
|
||||
#ifdef WIRE_COMPRESS_SUPPORT
|
||||
if (slct_zport)
|
||||
{
|
||||
if ((slct_zport->port_flags & PORT_z_data) &&
|
||||
(slct_zport->port_state != rem_port::DISCONNECTED))
|
||||
{
|
||||
port = slct_zport;
|
||||
slct_zport = NULL; // Will be set again by select_multi() if needed
|
||||
return SEL_READY;
|
||||
}
|
||||
|
||||
slct_zport = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (slct_port && slct_port->port_state == rem_port::DISCONNECTED)
|
||||
{
|
||||
// restart from main port
|
||||
@ -309,6 +327,13 @@ public:
|
||||
return ok(port);
|
||||
}
|
||||
|
||||
void setZDataPort(RemPortPtr& port)
|
||||
{
|
||||
#ifdef WIRE_COMPRESS_SUPPORT
|
||||
slct_zport = port;
|
||||
#endif
|
||||
}
|
||||
|
||||
HandleState ok(const rem_port* port)
|
||||
{
|
||||
#ifdef WIRE_COMPRESS_SUPPORT
|
||||
@ -388,6 +413,9 @@ public:
|
||||
#endif
|
||||
slct_main = NULL;
|
||||
slct_port = NULL;
|
||||
#ifdef WIRE_COMPRESS_SUPPORT
|
||||
slct_zport = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
void select(timeval* timeout)
|
||||
@ -456,6 +484,9 @@ private:
|
||||
#endif
|
||||
RemPortPtr slct_main; // first port to check for readyness
|
||||
RemPortPtr slct_port; // next port to check for readyness
|
||||
#ifdef WIRE_COMPRESS_SUPPORT
|
||||
RemPortPtr slct_zport; // port with some compressed data remaining in the buffer
|
||||
#endif
|
||||
};
|
||||
|
||||
static bool accept_connection(rem_port*, const P_CNCT*);
|
||||
@ -2085,6 +2116,10 @@ static bool select_multi(rem_port* main_port, UCHAR* buffer, SSHORT bufsize, SSH
|
||||
{
|
||||
*length = 0;
|
||||
}
|
||||
#ifdef WIRE_COMPRESS_SUPPORT
|
||||
if (port->port_flags & PORT_z_data)
|
||||
INET_select->setZDataPort(port);
|
||||
#endif
|
||||
return (*length) ? true : false;
|
||||
}
|
||||
|
||||
@ -2109,6 +2144,10 @@ static bool select_multi(rem_port* main_port, UCHAR* buffer, SSHORT bufsize, SSH
|
||||
}
|
||||
*length = 0;
|
||||
}
|
||||
#ifdef WIRE_COMPRESS_SUPPORT
|
||||
if (port->port_flags & PORT_z_data)
|
||||
INET_select->setZDataPort(port);
|
||||
#endif
|
||||
return (*length) ? true : false;
|
||||
}
|
||||
if (!select_wait(main_port, &INET_select))
|
||||
|
@ -1509,6 +1509,10 @@ bool REMOTE_inflate(rem_port* port, PacketReceive* packet_receive, UCHAR* buffer
|
||||
else
|
||||
port->port_flags &= ~PORT_z_data;
|
||||
|
||||
#ifdef COMPRESS_DEBUG
|
||||
fprintf(stderr, "Z-buffer %s\n", port->port_flags & PORT_z_data ? "has data" : "is empty");
|
||||
#endif
|
||||
|
||||
return true;
|
||||
#else
|
||||
return packet_receive(port, buffer, buffer_length, length);
|
||||
|
Loading…
Reference in New Issue
Block a user