about summary refs log tree commit diff
path: root/bounce.h
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-05-11 18:05:41 -0400
committerJune McEnroe <june@causal.agency>2020-05-11 18:16:19 -0400
commit548c4a3a86a37cf74aac5ef91f84b9a762dc1023 (patch)
tree810cdf6ea4d26421f4b2a36f3a35bda745fec628 /bounce.h
parentPass -1 as backlog to listen(2) (diff)
downloadpounce-548c4a3a86a37cf74aac5ef91f84b9a762dc1023.tar.gz
pounce-548c4a3a86a37cf74aac5ef91f84b9a762dc1023.zip
Add server send queueing with time interval
This addresses pounce getting killed with "Excess flood" when it sends
NAMES commands for too many channels when a client connects. These
commands, as well as automatic AWAY commands, are by default throttled
to 5 per second.

Tested on freenode with 36 channels and 200ms interval.
Diffstat (limited to '')
-rw-r--r--bounce.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/bounce.h b/bounce.h
index a5dc836..20852cb 100644
--- a/bounce.h
+++ b/bounce.h
@@ -159,12 +159,16 @@ size_t localBind(int fds[], size_t cap, const char *host, const char *port);
 size_t localUnix(int fds[], size_t cap, const char *path);
 struct tls *localAccept(int *fd, int bind);
 
+extern struct timeval serverQueueInterval;
 void serverConfig(bool insecure, const char *cert, const char *priv);
 int serverConnect(const char *bindHost, const char *host, const char *port);
 void serverRecv(void);
 void serverSend(const char *ptr, size_t len);
 void serverFormat(const char *format, ...)
 	__attribute__((format(printf, 1, 2)));
+void serverEnqueue(const char *format, ...)
+	__attribute__((format(printf, 1, 2)));
+void serverDequeue(void);
 
 extern bool clientCA;
 extern bool clientSTS;