Commits (1)
......@@ -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
......
......@@ -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);
}
}
}
......
......@@ -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);
......
......@@ -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);
}
}
}
......