Commit b2a5ba18 authored by deuce's avatar deuce
Browse files

More hacks to work around a known bug in Cryptlib SSH...

"Sometimes" the write timeout value is used for read timeouts.  Since we
use a read timeout of zero, and a mutex, this can cause some serious delays
in SSH processing.  As a workaround, we set the write timeout to zero.
However, a flush failure has historically been fatal.

So, we now change the write timeout to one second just before a flush, and
have a flush timeout not be fatal anymore... we set it back to zero after
the flush.

The fiddling with the write timouts will be removed once the bug is fixed,
but the flush timout not being fatal may stay forever... add some comments
to remind us to remove the hack in the future.
parent 19326929
......@@ -2415,13 +2415,21 @@ void output_thread(void* arg)
i=buftop-bufbot; // Pretend we sent it all
}
else {
// READ = WRITE TIMEOUT HACK... REMOVE WHEN FIXED
if(cryptStatusError(i=cryptSetAttribute(sbbs->ssh_session, CRYPT_OPTION_NET_WRITETIMEOUT, 1)))
GCESS(i, sbbs->client_socket, sbbs->ssh_session, "setting write timeout");
if(cryptStatusError((err=cryptFlushData(sbbs->ssh_session)))) {
GCES(err, sbbs->cfg.node_num, sbbs->ssh_session, "flushing data");
ssh_errors++;
if (err != CRYPT_ERROR_TIMEOUT) {
sbbs->online=FALSE;
i=buftop-bufbot; // Pretend we sent it all
}
}
// READ = WRITE TIMEOUT HACK... REMOVE WHEN FIXED
if(cryptStatusError(i=cryptSetAttribute(sbbs->ssh_session, CRYPT_OPTION_NET_WRITETIMEOUT, 0)))
GCESS(i, sbbs->client_socket, sbbs->ssh_session, "setting write timeout");
}
}
pthread_mutex_unlock(&sbbs->ssh_mutex);
}
......@@ -5473,6 +5481,7 @@ NO_SSH:
}
if(cryptStatusError(i=cryptSetAttribute(sbbs->ssh_session, CRYPT_OPTION_NET_READTIMEOUT, 0)))
GCESS(i, sbbs->client_socket, sbbs->ssh_session, "setting read timeout");
// READ = WRITE TIMEOUT HACK... REMOVE WHEN FIXED
if(cryptStatusError(i=cryptSetAttribute(sbbs->ssh_session, CRYPT_OPTION_NET_WRITETIMEOUT, 0)))
GCESS(i, sbbs->client_socket, sbbs->ssh_session, "setting write timeout");
#if 0
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment