| 92 | } |
| 93 | |
| 94 | int CNetwork::Update() |
| 95 | { |
| 96 | NETSOCKET Socket; |
| 97 | NETADDR Addr; |
| 98 | |
| 99 | if(net_tcp_accept(m_Socket, &Socket, &Addr) > 0) |
| 100 | { |
| 101 | // check if we should just drop the packet |
| 102 | char aBuf[128]; |
| 103 | if(NetBan() && NetBan()->IsBanned(&Addr, aBuf, sizeof(aBuf))) |
| 104 | { |
| 105 | // banned, reply with a message and drop |
| 106 | net_tcp_send(Socket, aBuf, str_length(aBuf)); |
| 107 | net_tcp_close(Socket); |
| 108 | } |
| 109 | else |
| 110 | AcceptClient(Socket, &Addr); |
| 111 | } |
| 112 | |
| 113 | for(int i = 0; i < NET_MAX_CLIENTS; i++) |
| 114 | { |
| 115 | if(m_aSlots[i].m_Connection.State() == NET_CONNSTATE_ONLINE) |
| 116 | m_aSlots[i].m_Connection.Update(); |
| 117 | if(m_aSlots[i].m_Connection.State() == NET_CONNSTATE_ERROR) |
| 118 | Drop(i, m_aSlots[i].m_Connection.ErrorString()); |
| 119 | } |
| 120 | |
| 121 | return 0; |
| 122 | } |
| 123 | |
| 124 | int CNetwork::Recv(char *pLine, int MaxLength, int *pClientID) |
| 125 | { |
nothing calls this directly
no test coverage detected