mirror of
https://github.com/unrealircd/unrealircd.git
synced 2026-07-02 10:26:38 +02:00
Fixed MAJOR "messages are lost" caused by BUFFERPOOL being to low and bad return checking of dbuf_put.
If BUFFERPOOL dbuf_put would return -1, but at some places !dbuf_put was used, I've changed it so it will return 0 (so use !dbuf_put now, don't use dbuf_put(...) < 0 :P). I also added some nice warning thing. I couldn't send from the send routine because that's risky ;). And...... I also doubled the default BUFFERPOOL, so if you leave everything the default then BUFFERPOOL is now 52Mb instead of 26Mb, which should be ok for now.
This commit is contained in:
@@ -2023,3 +2023,7 @@ seen. gmtime warning still there
|
||||
- Fixed an SQLINE bug with sqlines without a reason
|
||||
- Fixed a bug effecting additions/deletions of SQLINES and deletions of SVSNLINES (may be
|
||||
the cause of #0000866)
|
||||
- Fixed MAJOR "messages are lost" bug which can cause various problems: ziplink corruption,
|
||||
duplicate user entry in sjoin, etc etc. This would happen if BUFFERPOOL was set too low (like
|
||||
the default) and you got a lot of traffic. It's now handled a bit better and you'll get
|
||||
a nice warning, additionally the default BUFFERPOOL is now set to MAXSENDQLENGTH*18 instead of *9.
|
||||
|
||||
@@ -86,7 +86,7 @@ ZIPLINKSDIR=""
|
||||
LISTEN_SIZE="5"
|
||||
NICKNAMEHISTORYLENGTH="2000"
|
||||
MAXSENDQLENGTH="3000000"
|
||||
BUFFERPOOL="9"
|
||||
BUFFERPOOL="18"
|
||||
MAXCONNECTIONS="1024"
|
||||
INET6=""
|
||||
EXTRAPARA=""
|
||||
|
||||
+1
-1
@@ -361,7 +361,7 @@
|
||||
* Recommended value is 2 * MAXSENDQLENGTH, for hubs, 5 *.
|
||||
*/
|
||||
#ifndef BUFFERPOOL
|
||||
#define BUFFERPOOL (9 * MAXSENDQLENGTH)
|
||||
#define BUFFERPOOL (18 * MAXSENDQLENGTH)
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
@@ -560,5 +560,6 @@ long config_checkval(char *value, unsigned short flags);
|
||||
void config_status(char *format, ...);
|
||||
void init_random();
|
||||
u_int32_t getrandom32();
|
||||
extern char trouble_info[1024];
|
||||
#define EVENT_DRUGS BASE_VERSION
|
||||
|
||||
|
||||
+9
-4
@@ -39,9 +39,7 @@
|
||||
#include "struct.h"
|
||||
#include "common.h"
|
||||
#include "sys.h"
|
||||
#ifdef USE_DMALLOC
|
||||
#include "h.h"
|
||||
#endif
|
||||
ID_Copyright("(C) 1990 Markku Savela");
|
||||
ID_Notes("2.17 1/30/94 (C) 1990 Markku Savela");
|
||||
#if !defined(VALLOC) && !defined(valloc) && !defined(USE_DMALLOC)
|
||||
@@ -84,6 +82,7 @@ static dbufbuf *dbuf_alloc(void)
|
||||
if (dbufalloc * DBUFSIZ > BUFFERPOOL)
|
||||
{
|
||||
dbufalloc--;
|
||||
strcpy(trouble_info, "buffer allocation error! Increase BUFFERPOOL!");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -100,7 +99,10 @@ static dbufbuf *dbuf_alloc(void)
|
||||
|
||||
dbptr = (dbufbuf *)valloc(num * sizeof(dbufbuf));
|
||||
if (!dbptr)
|
||||
{
|
||||
strcpy(trouble_info, "buffer allocation error! Out of memory! OUCH!!!");
|
||||
return (dbufbuf *)NULL;
|
||||
}
|
||||
|
||||
num--;
|
||||
for (db2ptr = dbptr; num; num--)
|
||||
@@ -112,7 +114,10 @@ static dbufbuf *dbuf_alloc(void)
|
||||
return dbptr;
|
||||
#else
|
||||
dbufblocks++;
|
||||
return (dbufbuf *)MyMalloc(sizeof(dbufbuf));
|
||||
dbptr = (dbufbuf *)MyMalloc(sizeof(dbufbuf));
|
||||
if (!dbptr)
|
||||
strcpy(trouble_info, "buffer allocation error! Out of memory! OUCH!!!");
|
||||
return dbptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -144,7 +149,7 @@ static int dbuf_malloc_error(dbuf *dyn)
|
||||
dbuf_free(p);
|
||||
}
|
||||
dyn->tail = dyn->head;
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -129,6 +129,7 @@ TS check_fdlists();
|
||||
#endif
|
||||
|
||||
unsigned char conf_debuglevel = 0;
|
||||
char trouble_info[1024];
|
||||
|
||||
void save_stats(void)
|
||||
{
|
||||
@@ -1393,6 +1394,14 @@ void SocketLoop(void *dummy)
|
||||
nextfdlistcheck = check_fdlists(timeofday);
|
||||
#endif
|
||||
flush_connections(&me);
|
||||
|
||||
/* ThA UnReAl TrOuBlE RePoRtInG SyStEm!!! */
|
||||
if (trouble_info[0] != '\0')
|
||||
{
|
||||
sendto_realops("*** TROUBLE: %s ***", trouble_info);
|
||||
ircd_log(LOG_ERROR, "TROUBLE: %s", trouble_info);
|
||||
trouble_info[0] = '\0';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -1400,7 +1400,7 @@ static int read_packet(aClient *cptr, fd_set *rfd)
|
||||
** it on the end of the receive queue and do it when its
|
||||
** turn comes around.
|
||||
*/
|
||||
if (dbuf_put(&cptr->recvQ, readbuf, length) < 0)
|
||||
if (!dbuf_put(&cptr->recvQ, readbuf, length))
|
||||
return exit_client(cptr, cptr, cptr, "dbuf_put fail");
|
||||
|
||||
if (IsPerson(cptr) && DBufLength(&cptr->recvQ) > get_recvq(cptr))
|
||||
@@ -1563,7 +1563,7 @@ static int read_packet(aClient *cptr)
|
||||
* Before we even think of parsing what we just read, stick
|
||||
* it on the end of the receive queue and do it when its turn
|
||||
* comes around. */
|
||||
if (dbuf_put(&cptr->recvQ, readbuf, length) < 0)
|
||||
if (!dbuf_put(&cptr->recvQ, readbuf, length))
|
||||
return exit_client(cptr, cptr, cptr, "dbuf_put fail");
|
||||
|
||||
if (IsPerson(cptr) &&
|
||||
|
||||
Reference in New Issue
Block a user