MCPcopy Create free account
hub / github.com/cppla/ServerStatus / Update

Method Update

server/src/network.cpp:94–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92}
93
94int 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
124int CNetwork::Recv(char *pLine, int MaxLength, int *pClientID)
125{

Callers

nothing calls this directly

Calls 7

net_tcp_acceptFunction · 0.85
net_tcp_sendFunction · 0.85
str_lengthFunction · 0.85
net_tcp_closeFunction · 0.85
IsBannedMethod · 0.80
StateMethod · 0.80
ErrorStringMethod · 0.80

Tested by

no test coverage detected