X-Git-Url: https://git.librecmc.org/?p=oweals%2Ftinc.git;a=blobdiff_plain;f=src%2Fprotocol_misc.c;fp=src%2Fprotocol_misc.c;h=b2f6ddc5f3f0e3b8e4ea3cd41d09ec54b1f10ec8;hp=ea71d6bfbc0e81217b9a9b815413d0647e5d4dee;hb=228e7a5c8f0e517dcede50f886965a44fca39853;hpb=a5a4d2b865879b8694760c0a5b5909c9a3675027 diff --git a/src/protocol_misc.c b/src/protocol_misc.c index ea71d6b..b2f6ddc 100644 --- a/src/protocol_misc.c +++ b/src/protocol_misc.c @@ -31,6 +31,8 @@ #include "protocol.h" #include "utils.h" +int maxoutbufsize = 0; + /* Status and error notification routines */ bool send_status(connection_t *c, int statusno, const char *statusstring) @@ -153,7 +155,10 @@ bool send_tcppacket(connection_t *c, vpn_packet_t *packet) { cp(); - /* Evil hack. */ + /* If there already is a lot of data in the outbuf buffer, discard this packet. */ + + if(c->outbuflen > maxoutbufsize) + return true; if(!send_request(c, "%d %hd", PACKET, packet->len)) return false;