Use timeout error for TCP timeouts on unix
When a TCP connection timed out a QAbstractSocket::NetworkError was set. To enable a more precise error handling for timeouts QAbstractSocket::SocketTimeoutError is now set instead. Separated ETIMEDOUT from other errors in nativeRead() and take over responsibility for setting the error, which was previously handled by read(). Change-Id: Iccd45bdbb3d944cd160ae50c257d3256e05b1ae5 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: David Faure <david.faure@kdab.com>bb10
parent
f018e315fd
commit
6f251c567c
|
|
@ -1383,19 +1383,23 @@ qint64 QNativeSocketEnginePrivate::nativeRead(char *data, qint64 maxSize)
|
|||
// No data was available for reading
|
||||
r = -2;
|
||||
break;
|
||||
case EBADF:
|
||||
case EINVAL:
|
||||
case EIO:
|
||||
//error string is now set in read(), not here in nativeRead()
|
||||
break;
|
||||
case ECONNRESET:
|
||||
#if defined(Q_OS_VXWORKS)
|
||||
case ESHUTDOWN:
|
||||
#endif
|
||||
r = 0;
|
||||
break;
|
||||
default:
|
||||
case ETIMEDOUT:
|
||||
socketError = QAbstractSocket::SocketTimeoutError;
|
||||
break;
|
||||
default:
|
||||
socketError = QAbstractSocket::NetworkError;
|
||||
break;
|
||||
}
|
||||
|
||||
if (r == -1) {
|
||||
hasSetSocketError = true;
|
||||
socketErrorString = qt_error_string();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue