From ff7e53bb99611f8a1a06319d0c17969fda2b9a10 Mon Sep 17 00:00:00 2001 From: Aleksandar Sasha Babic Date: Mon, 18 May 2009 10:24:07 +0200 Subject: 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. --- src/corelib/kernel/qeventdispatcher_symbian.cpp | 33 +++++++++++++++++++++++-- 1 file 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::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::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 toRemove; for (QHash::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); } } -- cgit v0.12