diff options
author | Aleksandar Sasha Babic <aleksandar.babic@nokia.com> | 2009-05-18 08:24:07 (GMT) |
---|---|---|
committer | Aleksandar Sasha Babic <aleksandar.babic@nokia.com> | 2009-05-18 08:24:07 (GMT) |
commit | ff7e53bb99611f8a1a06319d0c17969fda2b9a10 (patch) | |
tree | b430e83e288fe6c1dba5eeabda4da88060e129b1 /src/corelib/kernel | |
parent | b1ed2310319fc8b7144d07d420c8cb4fd1ac68d2 (diff) | |
download | Qt-ff7e53bb99611f8a1a06319d0c17969fda2b9a10.zip Qt-ff7e53bb99611f8a1a06319d0c17969fda2b9a10.tar.gz Qt-ff7e53bb99611f8a1a06319d0c17969fda2b9a10.tar.bz2 |
By default we have socket notifier for read/write.
Therefore we will force monitoring socket's
exception status when doing select() call.
We will also signal notifier when and if exception
on socket occured.
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_symbian.cpp | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp index 6c47c7b..3282b7c 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian.cpp +++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp @@ -393,11 +393,29 @@ void QSelectThread::restart() int QSelectThread::updateSocketSet(QSocketNotifier::Type type, fd_set *fds) { int maxfd = 0; - for (QHash<QSocketNotifier *, TRequestStatus *>::const_iterator i = m_AOStatuses.begin(); + if(m_AOStatuses.isEmpty()) { + /* + * Wonder if should return -1 + * to signal that no descriptors + * added to fds + */ + return maxfd; + } + for ( QHash<QSocketNotifier *, TRequestStatus *>::const_iterator i = m_AOStatuses.begin(); i != m_AOStatuses.end(); ++i) { if (i.key()->type() == type) { FD_SET(i.key()->socket(), fds); maxfd = qMax(maxfd, i.key()->socket()); + } else if(type == QSocketNotifier::Exception) { + /* + * We are registering existing sockets + * always to exception set + * + * Doing double FD_SET shouldn't + * matter + */ + FD_SET(i.key()->socket(), fds); + maxfd = qMax(maxfd, i.key()->socket()); } } @@ -407,7 +425,9 @@ int QSelectThread::updateSocketSet(QSocketNotifier::Type type, fd_set *fds) void QSelectThread::updateActivatedNotifiers(QSocketNotifier::Type type, fd_set *fds) { Q_D(QThread); - + if(m_AOStatuses.isEmpty()) { + return; + } QList<QSocketNotifier *> toRemove; for (QHash<QSocketNotifier *, TRequestStatus *>::const_iterator i = m_AOStatuses.begin(); i != m_AOStatuses.end(); ++i) { @@ -416,6 +436,15 @@ void QSelectThread::updateActivatedNotifiers(QSocketNotifier::Type type, fd_set TRequestStatus *status = i.value(); // Thread data is still owned by the main thread. QEventDispatcherSymbian::RequestComplete(d->threadData->symbian_thread_handle, status, KErrNone); + } else if(type == QSocketNotifier::Exception && FD_ISSET(i.key()->socket(), fds)) { + /* + * check if socket is in exception set + * then signal RequestComplete for it + */ + qWarning("exception on %d", i.key()->socket()); + toRemove.append(i.key()); + TRequestStatus *status = i.value(); + QEventDispatcherSymbian::RequestComplete(d->threadData->symbian_thread_handle, status, KErrNone); } } |