| 2067 | } |
| 2068 | |
| 2069 | static bool select_multi(rem_port* main_port, UCHAR* buffer, SSHORT bufsize, SSHORT* length, |
| 2070 | RemPortPtr& port) |
| 2071 | { |
| 2072 | /************************************** |
| 2073 | * |
| 2074 | * s e l e c t _ m u l t i |
| 2075 | * |
| 2076 | ************************************** |
| 2077 | * |
| 2078 | * Functional description |
| 2079 | * Receive an IP packet from a port or clients of a port. |
| 2080 | * Used only by the multiclient server on main server's port. |
| 2081 | * If a connection request comes in, generate a new port |
| 2082 | * block for the client. |
| 2083 | * |
| 2084 | **************************************/ |
| 2085 | |
| 2086 | // This code is used to test error handling in main server loop |
| 2087 | #ifdef NEVERDEF |
| 2088 | static int dummyCnt = 0; |
| 2089 | if (++dummyCnt % 64 == 0) |
| 2090 | (Arg::Gds(isc_random) << "Simulated select_multi error").raise(); |
| 2091 | #endif |
| 2092 | |
| 2093 | for (;;) |
| 2094 | { |
| 2095 | select_port(main_port, &INET_select, port); |
| 2096 | if (port == main_port && (port->port_server_flags & SRVR_multi_client)) |
| 2097 | { |
| 2098 | if (INET_shutting_down) |
| 2099 | { |
| 2100 | if (main_port->port_state == rem_port::PENDING) |
| 2101 | { |
| 2102 | main_port->port_state = rem_port::BROKEN; |
| 2103 | |
| 2104 | shutdown(main_port->port_handle, 2); |
| 2105 | SOCLOSE(main_port->port_handle); |
| 2106 | } |
| 2107 | } |
| 2108 | else if ((port = select_accept(main_port))) |
| 2109 | { |
| 2110 | if (!REMOTE_inflate(port, packet_receive, buffer, bufsize, length)) |
| 2111 | { |
| 2112 | *length = 0; |
| 2113 | } |
| 2114 | #ifdef WIRE_COMPRESS_SUPPORT |
| 2115 | if (port->port_z_data) |
| 2116 | INET_select->setZDataPort(port); |
| 2117 | #endif |
| 2118 | return (*length) ? true : false; |
| 2119 | } |
| 2120 | |
| 2121 | continue; |
| 2122 | } |
| 2123 | if (port) |
| 2124 | { |
| 2125 | if (port->port_dummy_timeout < 0) |
| 2126 | { |
nothing calls this directly
no test coverage detected