MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / select_port

Function select_port

src/remote/inet.cpp:2191–2239  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2189}
2190
2191static void select_port(rem_port* main_port, Select* selct, RemPortPtr& port)
2192{
2193/**************************************
2194 *
2195 * s e l e c t _ p o r t
2196 *
2197 **************************************
2198 *
2199 * Functional description
2200 * Select a descriptor that is ready to read
2201 * and return the port block. Additionally,
2202 * check if a port's keepalive timer has
2203 * expired and return the port block so that
2204 * a keepalive packet can be queued. Return
2205 * NULL if none are active.
2206 *
2207 **************************************/
2208
2209 MutexLockGuard guard(port_mutex, FB_FUNCTION);
2210 while (true)
2211 {
2212 Select::HandleState result = selct->checkNext(port);
2213 if (!port)
2214 return;
2215
2216 switch (result)
2217 {
2218 case Select::SEL_BAD:
2219 if (port->port_state == rem_port::BROKEN || (port->port_flags & PORT_connecting))
2220 continue;
2221 if (port->port_flags & PORT_async)
2222 continue;
2223 return;
2224
2225 case Select::SEL_DISCONNECTED:
2226 continue;
2227
2228 case Select::SEL_READY:
2229 port->port_dummy_timeout = port->port_dummy_packet_interval;
2230 return;
2231
2232 default:
2233 break;
2234 }
2235
2236 if (port->port_dummy_timeout < 0)
2237 return;
2238 }
2239}
2240
2241static bool select_wait( rem_port* main_port, Select* selct)
2242{

Callers 1

select_multiFunction · 0.85

Calls 1

checkNextMethod · 0.80

Tested by

no test coverage detected