diff --git a/ctrl/sbbs.ini b/ctrl/sbbs.ini index 82988c785c8eade1e829ed51266f64ec1f55bf97..7dcd5c5147f96c7ce2a2686945d32b75c79beec0 100644 --- a/ctrl/sbbs.ini +++ b/ctrl/sbbs.ini @@ -112,10 +112,8 @@ DOSemuConfPath = dosemu.conf ; ie: Send output whenever there are at least this many bytes waiting. ; This should definately not be higher than the MTU. ; -; On Linux and BSD (Any platform which supports the TCP_MAXSEG socket opt) -; This can (and probably should) be set to zero to automagically set the -; highwater mark to the MSS and ensure no single call to send() is larger -; than this. +; This is only a default, when possible, the MSS of a socket is detected +; and used instead. OutbufHighwaterMark = 1024 ; Timout to wait for output buffer to fill (Milliseconds) ; If there is ANY data in the output buffer after waiting this long, send diff --git a/src/sbbs3/main.cpp b/src/sbbs3/main.cpp index 3c15875326b2a54aea9923ff3050edc2a1632a9f..634244b2624011faabd0baa623842d8306b90067 100644 --- a/src/sbbs3/main.cpp +++ b/src/sbbs3/main.cpp @@ -2297,43 +2297,41 @@ void output_thread(void* arg) * Auto-tune the highwater mark to be the negotiated MSS for the * socket (when possible) */ - if(!sbbs->outbuf.highwater_mark) { - socklen_t sl; - sl=sizeof(i); - if(!getsockopt(sbbs->client_socket, IPPROTO_TCP, TCP_MAXSEG, + socklen_t sl; + sl=sizeof(i); + if(!getsockopt(sbbs->client_socket, IPPROTO_TCP, TCP_MAXSEG, #ifdef _WIN32 - (char *) + (char *) #endif - &i, &sl)) { - /* Check for sanity... */ - if(i>100) { + &i, &sl)) { + /* Check for sanity... */ + if(i>100) { #ifdef _WIN32 #ifdef TCP_TIMESTAMPS - DWORD ts; - sl = sizeof(ts); - if (!getsockopt(sbbs->client_socket, IPPROTO_TCP, TCP_TIMESTAMPS, (char *)&ts, &sl)) { - if (ts) - i -= 12; - } + DWORD ts; + sl = sizeof(ts); + if (!getsockopt(sbbs->client_socket, IPPROTO_TCP, TCP_TIMESTAMPS, (char *)&ts, &sl)) { + if (ts) + i -= 12; + } #endif #else #if (defined(TCP_INFO) && defined(TCPI_OPT_TIMESTAMPS)) - struct tcp_info tcpi; + struct tcp_info tcpi; - sl = sizeof(tcpi); - if (!getsockopt(sbbs->client_socket, IPPROTO_TCP, TCP_INFO,&tcpi, &sl)) { - if (tcpi.tcpi_options & TCPI_OPT_TIMESTAMPS) - i -= 12; - } + sl = sizeof(tcpi); + if (!getsockopt(sbbs->client_socket, IPPROTO_TCP, TCP_INFO,&tcpi, &sl)) { + if (tcpi.tcpi_options & TCPI_OPT_TIMESTAMPS) + i -= 12; + } #endif #endif - sbbs->outbuf.highwater_mark=i; - lprintf(LOG_DEBUG,"Autotuning outbuf highwater mark to %d based on MSS",i); - mss=sbbs->outbuf.highwater_mark; - if(mss>IO_THREAD_BUF_SIZE) { - mss=IO_THREAD_BUF_SIZE; - lprintf(LOG_DEBUG,"MSS (%d) is higher than IO_THREAD_BUF_SIZE (%d)",i,IO_THREAD_BUF_SIZE); - } + sbbs->outbuf.highwater_mark=i; + lprintf(LOG_DEBUG,"Autotuning outbuf highwater mark to %d based on MSS",i); + mss=sbbs->outbuf.highwater_mark; + if(mss>IO_THREAD_BUF_SIZE) { + mss=IO_THREAD_BUF_SIZE; + lprintf(LOG_DEBUG,"MSS (%d) is higher than IO_THREAD_BUF_SIZE (%d)",i,IO_THREAD_BUF_SIZE); } } } diff --git a/src/sbbs3/sbbs_ini.c b/src/sbbs3/sbbs_ini.c index 3495e031066d5c17de5cb9ec394344f20f401817..31ac1f5c8edc3ad18a7701435aca09f1906e6443 100644 --- a/src/sbbs3/sbbs_ini.c +++ b/src/sbbs3/sbbs_ini.c @@ -398,13 +398,7 @@ void sbbs_read_ini( =iniGetShortInt(list,section,"LastNode",4); bbs->outbuf_highwater_mark - =iniGetShortInt(list,section,"OutbufHighwaterMark" -#ifdef TCP_MAXSEG /* Auto-tune if possible. Would this be defined here? */ - ,0 -#else - ,1024 -#endif - ); + =iniGetShortInt(list,section,"OutbufHighwaterMark" ,1024); bbs->outbuf_drain_timeout =iniGetShortInt(list,section,"OutbufDrainTimeout",10); diff --git a/src/sbbs3/websrvr.c b/src/sbbs3/websrvr.c index 0cb535f1de963bfcce67de30166c09a2186f8a4a..c2e066e7134223a36deb63911b28912e334e1eba 100644 --- a/src/sbbs3/websrvr.c +++ b/src/sbbs3/websrvr.c @@ -6359,41 +6359,39 @@ void http_output_thread(void *arg) * Auto-tune the highwater mark to be the negotiated MSS for the * socket (when possible) */ - if(!obuf->highwater_mark) { - socklen_t sl; - sl=sizeof(i); - if(!getsockopt(session->socket, IPPROTO_TCP, TCP_MAXSEG, (char*)&i, &sl)) { - /* Check for sanity... */ - if(i>100) { + socklen_t sl; + sl=sizeof(i); + if(!getsockopt(session->socket, IPPROTO_TCP, TCP_MAXSEG, (char*)&i, &sl)) { + /* Check for sanity... */ + if(i>100) { #ifdef _WIN32 #ifdef TCP_TIMESTAMPS - DWORD ts; - sl = sizeof(ts); - if (!getsockopt(session->socket, IPPROTO_TCP, TCP_TIMESTAMPS, (char *)&ts, &sl)) { - if (ts) - i -= 12; - } + DWORD ts; + sl = sizeof(ts); + if (!getsockopt(session->socket, IPPROTO_TCP, TCP_TIMESTAMPS, (char *)&ts, &sl)) { + if (ts) + i -= 12; + } #endif #else #if (defined(TCP_INFO) && defined(TCPI_OPT_TIMESTAMPS)) - struct tcp_info tcpi; + struct tcp_info tcpi; - sl = sizeof(tcpi); - if (!getsockopt(session->socket, IPPROTO_TCP, TCP_INFO,&tcpi, &sl)) { - if (tcpi.tcpi_options & TCPI_OPT_TIMESTAMPS) - i -= 12; - } + sl = sizeof(tcpi); + if (!getsockopt(session->socket, IPPROTO_TCP, TCP_INFO,&tcpi, &sl)) { + if (tcpi.tcpi_options & TCPI_OPT_TIMESTAMPS) + i -= 12; + } #endif #endif - obuf->highwater_mark=i; - lprintf(LOG_DEBUG,"%04d Autotuning outbuf highwater mark to %d based on MSS" - ,session->socket,i); - mss=obuf->highwater_mark; - if(mss>OUTBUF_LEN) { - mss=OUTBUF_LEN; - lprintf(LOG_DEBUG,"%04d MSS (%d) is higher than OUTBUF_LEN (%d)" - ,session->socket,i,OUTBUF_LEN); - } + obuf->highwater_mark=i; + lprintf(LOG_DEBUG,"%04d Autotuning outbuf highwater mark to %d based on MSS" + ,session->socket,i); + mss=obuf->highwater_mark; + if(mss>OUTBUF_LEN) { + mss=OUTBUF_LEN; + lprintf(LOG_DEBUG,"%04d MSS (%d) is higher than OUTBUF_LEN (%d)" + ,session->socket,i,OUTBUF_LEN); } } }