BlackBerry networking: call special select() method
... so that the socket notifiers are enabled after selecting and thus emit signals even after selecting (select() is called e.g. by the waitFor* methods). Task-number: QTBUG-36144 Change-Id: I385f288e8c42f92a9c84e53bce843e52f8094ada Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com> Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com> Reviewed-by: Fanda Vacek <fvacek@blackberry.com> Reviewed-by: Bernd Weimer <bweimer@blackberry.com> Reviewed-by: Richard J. Moore <rich@kde.org>
This commit is contained in:
parent
ba4d154737
commit
53f81ac946
@ -1120,6 +1120,53 @@ qint64 QNativeSocketEnginePrivate::nativeRead(char *data, qint64 maxSize)
|
|||||||
return qint64(r);
|
return qint64(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef Q_OS_BLACKBERRY
|
||||||
|
int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool selectForRead) const
|
||||||
|
{
|
||||||
|
fd_set fds;
|
||||||
|
FD_ZERO(&fds);
|
||||||
|
FD_SET(socketDescriptor, &fds);
|
||||||
|
|
||||||
|
int retval;
|
||||||
|
QList<QSocketNotifier *> notifiers;
|
||||||
|
if (selectForRead) {
|
||||||
|
notifiers << readNotifier;
|
||||||
|
retval = bb_select(notifiers, socketDescriptor + 1, &fds, 0, timeout);
|
||||||
|
} else {
|
||||||
|
notifiers << writeNotifier;
|
||||||
|
retval = bb_select(notifiers, socketDescriptor + 1, 0, &fds, timeout);
|
||||||
|
}
|
||||||
|
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool checkRead, bool checkWrite,
|
||||||
|
bool *selectForRead, bool *selectForWrite) const
|
||||||
|
{
|
||||||
|
fd_set fdread;
|
||||||
|
FD_ZERO(&fdread);
|
||||||
|
if (checkRead)
|
||||||
|
FD_SET(socketDescriptor, &fdread);
|
||||||
|
|
||||||
|
fd_set fdwrite;
|
||||||
|
FD_ZERO(&fdwrite);
|
||||||
|
if (checkWrite)
|
||||||
|
FD_SET(socketDescriptor, &fdwrite);
|
||||||
|
|
||||||
|
QList<QSocketNotifier *> notifiers;
|
||||||
|
notifiers << readNotifier << writeNotifier;
|
||||||
|
int ret = bb_select(notifiers, socketDescriptor + 1, &fdread, &fdwrite, timeout);
|
||||||
|
|
||||||
|
if (ret <= 0)
|
||||||
|
return ret;
|
||||||
|
*selectForRead = FD_ISSET(socketDescriptor, &fdread);
|
||||||
|
*selectForWrite = FD_ISSET(socketDescriptor, &fdwrite);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else // not Q_OS_BLACKBERRY:
|
||||||
|
|
||||||
int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool selectForRead) const
|
int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool selectForRead) const
|
||||||
{
|
{
|
||||||
fd_set fds;
|
fd_set fds;
|
||||||
@ -1166,5 +1213,6 @@ int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool checkRead, bool c
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
#endif // Q_OS_BLACKBERRY
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
Loading…
Reference in New Issue
Block a user