summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 984fd4c)
raw | patch | inline | side by side (parent: 984fd4c)
author | fgsfds <pvt.fgsfds@gmail.com> | |
Fri, 2 Jun 2023 20:53:21 +0000 (20:53 +0000) | ||
committer | Dmitry D. Chernov <blackdoomer@yandex.ru> | |
Sat, 3 Jun 2023 21:59:40 +0000 (07:59 +1000) |
src/mastersrv/master.c | patch | blob | history |
diff --git a/src/mastersrv/master.c b/src/mastersrv/master.c
index 4298476423109870b8973e2e77d77d604cdaf8e3..0b02b2d2854bdf397125affff7506ebbb764723a 100644 (file)
--- a/src/mastersrv/master.c
+++ b/src/mastersrv/master.c
case NET_MSG_LIST:
buf_send.pos = 0;
+ buf_send.overflow = 0;
b_write_uint8(&buf_send, NET_MSG_LIST);
clientver[0] = 0;
u_log(LOG_WARN, "address %s is sending packets too fast", u_iptostr(peer->address.host));
if (++cl_spam_cnt >= ms_spam_cap) {
ban_peer(peer, "spam");
+ cl_last_addr = 0;
return true;
}
} else {
enet_uint8 msgid = 0;
ENetEvent event;
while (running) {
- while (enet_host_service(ms_host, &event, 5000) > 0) {
+ while (enet_host_service(ms_host, &event, 1000) > 0) {
bool filtered = !event.peer || ban_check(event.peer->address.host);
- if (!filtered && event.type != ENET_EVENT_TYPE_DISCONNECT)
- filtered = spam_filter(event.peer);
+ if (!filtered && ms_spam_cap) filtered = spam_filter(event.peer);
if (!filtered) {
switch (event.type) {
if (event.packet) {
buf_recv.data = NULL;
- buf_recv.pos = 0;
- buf_recv.size = 0;
- buf_recv.overflow = 0;
enet_packet_destroy(event.packet);
}
}