fixing regression introduced by last patch for bug 278531, r+sr=bzbarsky

This commit is contained in:
darin%meer.net 2005-01-27 17:43:46 +00:00
Родитель cd5112aedf
Коммит 7fc0a1aece
5 изменённых файлов: 12 добавлений и 17 удалений

Просмотреть файл

@ -94,7 +94,9 @@ interface nsISocketTransport : nsITransport
boolean isAlive();
/**
* Socket timeouts in seconds.
* Socket timeouts in seconds. To specify no timeout, pass PR_UINT32_MAX
* as aValue to setTimeout. The implementation may truncate timeout values
* to a smaller range of values (e.g., 0 to 0xFFFF).
*/
unsigned long getTimeout(in unsigned long aType);
void setTimeout(in unsigned long aType, in unsigned long aValue);

Просмотреть файл

@ -219,11 +219,7 @@ nsServerSocket::OnSocketReady(PRFileDesc *fd, PRInt16 outFlags)
{
NS_ASSERTION(NS_SUCCEEDED(mCondition), "oops");
NS_ASSERTION(mFD == fd, "wrong file descriptor");
// If our poll timeout (of 2^16 seconds!) is reached, just go back to
// polling on the listening socket.
if (outFlags == -1)
return;
NS_ASSERTION(outFlags != -1, "unexpected timeout condition reached");
if (outFlags & (PR_POLL_ERR | PR_POLL_HUP | PR_POLL_NVAL))
{

Просмотреть файл

@ -72,14 +72,6 @@
//-----------------------------------------------------------------------------
// Large default timeouts approximate behavior of no timeout. (It's better to
// let the servers or host operating system time us out.) These timeout values
// are given in seconds.
#define DEFAULT_TIMEOUT_CONNECT (10 * 60)
#define DEFAULT_TIMEOUT_READ_WRITE (10 * 60)
//-----------------------------------------------------------------------------
static NS_DEFINE_CID(kSocketProviderServiceCID, NS_SOCKETPROVIDERSERVICE_CID);
static NS_DEFINE_CID(kDNSServiceCID, NS_DNSSERVICE_CID);
@ -704,8 +696,8 @@ nsSocketTransport::nsSocketTransport()
NS_ADDREF(gSocketTransportService);
mTimeouts[TIMEOUT_CONNECT] = DEFAULT_TIMEOUT_CONNECT;
mTimeouts[TIMEOUT_READ_WRITE] = DEFAULT_TIMEOUT_READ_WRITE;
mTimeouts[TIMEOUT_CONNECT] = PR_UINT16_MAX; // no timeout
mTimeouts[TIMEOUT_READ_WRITE] = PR_UINT16_MAX; // no timeout
}
nsSocketTransport::~nsSocketTransport()

Просмотреть файл

@ -568,7 +568,8 @@ nsSocketTransportService::Run()
s.mElapsedTime = 0;
s.mHandler->OnSocketReady(desc.fd, desc.out_flags);
}
else {
// check for timeout errors unless disabled...
else if (s.mHandler->mPollTimeout != PR_UINT16_MAX) {
// update elapsed time counter
if (NS_UNLIKELY(pollInterval > (PR_UINT16_MAX - s.mElapsedTime)))
s.mElapsedTime = PR_UINT16_MAX;

Просмотреть файл

@ -95,6 +95,10 @@ public:
// spent waiting for activity on this socket. if this timeout is reached,
// then OnSocketReady will be called with outFlags = -1.
//
// the default value for this member is PR_UINT16_MAX, which disables the
// timeout error checking. (i.e., a timeout value of PR_UINT16_MAX is
// never reached.)
//
PRUint16 mPollTimeout;
//