commit f732c7117e5a4b74b47c4594470506dcb2773760 from: Alexander Barton date: Sat Feb 12 22:24:56 2011 UTC Make write buffers bigger, but flush early This patch - makes the server write buffer bigger: 64k, - makes the regular write buffer bigger: 32k, - tries to flush the write buffer starting at 4K. Before this patch, a client got disconnected if the buffer flushing at 4k failed, now regular clients can store up to 32k and servers up 64k even if flushing is not possible at the moment (e.g. on slow links). commit - 477224be5c0d5e117d26d1181647bf9697c12c79 commit + f732c7117e5a4b74b47c4594470506dcb2773760 blob - e92240b6ff1548732f53e7d09e236b2a42ed23a9 blob + e58e6335a2a2cb298bbcf83703f7b7ccb666ddd2 --- src/ngircd/conn.c +++ src/ngircd/conn.c @@ -858,7 +858,7 @@ static bool Conn_Write( CONN_ID Idx, char *Data, size_t Len ) { CLIENT *c; - size_t writebuf_limit = WRITEBUFFER_LEN; + size_t writebuf_limit = WRITEBUFFER_MAX_LEN; assert( Idx > NONE ); assert( Data != NULL ); assert( Len > 0 ); @@ -894,7 +894,7 @@ Conn_Write( CONN_ID Idx, char *Data, size_t Len ) /* Uncompressed link: * Check if outbound buffer has enough space for the data. */ if (array_bytes(&My_Connections[Idx].wbuf) + Len >= - writebuf_limit) { + WRITEBUFFER_FLUSH_LEN) { /* Buffer is full, flush it. Handle_Write deals with * low-level errors, if any. */ if (!Handle_Write(Idx)) blob - 3f1122ca2fcaba6c93f502667a8ea0f5ffc73699 blob + ec7bee9320a566321a9990d9c97cff94db98fc6d --- src/ngircd/defines.h +++ src/ngircd/defines.h @@ -59,9 +59,12 @@ #define READBUFFER_LEN 2048 /* Size of the read buffer of a connection in bytes. */ -#define WRITEBUFFER_LEN 4096 /* Size of the write buffer of a +#define WRITEBUFFER_FLUSH_LEN 4096 /* Size of a write buffer that triggers + buffer flushing if more space is + needed for storing data. */ +#define WRITEBUFFER_MAX_LEN 32768 /* Maximum size of the write buffer of a connection in bytes. */ -#define WRITEBUFFER_SLINK_LEN 51200 /* Size of the write buffer of a +#define WRITEBUFFER_SLINK_LEN 65536 /* Maximum size of the write buffer of a server link connection in bytes. */ #define PROTOVER "0210" /* Implemented IRC protocol version,