MultiProcessIncoming reads incoming data off the unreliable and reliable ports and sends the data to process_big_data
| 2151 | // MultiProcessIncoming reads incoming data off the unreliable and reliable ports and sends |
| 2152 | // the data to process_big_data |
| 2153 | void MultiProcessIncoming() { |
| 2154 | int size, i; |
| 2155 | uint8_t *data; |
| 2156 | network_address from_addr; |
| 2157 | |
| 2158 | data = &(Multi_receive_buffer[0]); |
| 2159 | |
| 2160 | // get the other net players data |
| 2161 | while ((size = nw_Receive(data, &from_addr)) > 0) { |
| 2162 | MultiProcessBigData(data, size, &from_addr); |
| 2163 | if (ServerTimeout) { |
| 2164 | LastPacketReceived = timer_GetTime(); |
| 2165 | } |
| 2166 | } // end while |
| 2167 | |
| 2168 | // read reliable sockets for data |
| 2169 | data = &(Multi_receive_buffer[0]); |
| 2170 | if (Netgame.local_role == LR_SERVER) { |
| 2171 | for (i = 0; i < MAX_NET_PLAYERS; i++) { |
| 2172 | if (Player_num == i) |
| 2173 | continue; |
| 2174 | |
| 2175 | if ((NetPlayers[i].flags & NPF_CONNECTED) && (NetPlayers[i].reliable_socket != INVALID_SOCKET) && |
| 2176 | (NetPlayers[i].reliable_socket != 0)) { |
| 2177 | |
| 2178 | while ((size = nw_ReceiveReliable(NetPlayers[i].reliable_socket, data, MAX_RECEIVE_SIZE)) > 0) { |
| 2179 | MultiProcessBigData(data, size, &NetPlayers[i].addr); |
| 2180 | } |
| 2181 | } |
| 2182 | } |
| 2183 | } else { |
| 2184 | // if I'm not the master of the game, read reliable data from my connection with the server |
| 2185 | if ((NetPlayers[Player_num].reliable_socket != INVALID_SOCKET) && (NetPlayers[Player_num].reliable_socket != 0)) { |
| 2186 | while ((size = nw_ReceiveReliable(NetPlayers[Player_num].reliable_socket, data, MAX_RECEIVE_SIZE)) > 0) { |
| 2187 | MultiProcessBigData(data, size, &Netgame.server_address); |
| 2188 | } |
| 2189 | } |
| 2190 | } |
| 2191 | } |
| 2192 | |
| 2193 | // Starts a packet of data |
| 2194 | int START_DATA(int type, uint8_t *data, int *count, uint8_t reliable) { |
no test coverage detected