134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
uchar *p;
for (ServerInfo *si in servers) {
if (si.address.host == ENET_HOST_ANY)
continue;
p = ping;
putint(p, lastmillis);
buf.data = ping;
buf.dataLength = p - ping;
ENetAddress address = si.address;
enet_socket_send(pingsock, &address, &buf, 1);
}
lastinfo = lastmillis;
|
|
|
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
uchar *p;
for (ServerInfo *si in servers) {
if (si.address.host == ENET_HOST_ANY)
continue;
p = ping;
putint(&p, lastmillis);
buf.data = ping;
buf.dataLength = p - ping;
ENetAddress address = si.address;
enet_socket_send(pingsock, &address, &buf, 1);
}
lastinfo = lastmillis;
|
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
|
while (enet_socket_wait(pingsock, &events, 0) >= 0 && events) {
if (enet_socket_receive(pingsock, &addr, &buf, 1) <= 0)
return;
for (ServerInfo *si in servers) {
if (addr.host == si.address.host) {
p = ping;
si.ping = lastmillis - getint(p);
si.protocol = getint(p);
if (si.protocol != PROTOCOL_VERSION)
si.ping = 9998;
si.mode = getint(p);
si.numplayers = getint(p);
si.minremain = getint(p);
sgetstr();
si.map = @(text);
sgetstr();
si.sdesc = @(text);
break;
}
}
|
|
|
|
|
|
|
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
|
while (enet_socket_wait(pingsock, &events, 0) >= 0 && events) {
if (enet_socket_receive(pingsock, &addr, &buf, 1) <= 0)
return;
for (ServerInfo *si in servers) {
if (addr.host == si.address.host) {
p = ping;
si.ping = lastmillis - getint(&p);
si.protocol = getint(&p);
if (si.protocol != PROTOCOL_VERSION)
si.ping = 9998;
si.mode = getint(&p);
si.numplayers = getint(&p);
si.minremain = getint(&p);
sgetstr();
si.map = @(text);
sgetstr();
si.sdesc = @(text);
break;
}
}
|