summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qcfsocketnotifier.cpp
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@qt.io>2017-05-04 14:03:10 +0200
committerOswald Buddenhagen <oswald.buddenhagen@qt.io>2017-05-04 14:03:11 +0200
commit464a43d43c2bb2440d4ad745bc134e0dac10872c (patch)
treeb1c27b1d1c11f9c43bd2e62e1fd955bc6f89029f /src/corelib/kernel/qcfsocketnotifier.cpp
parent0208cac94fbd79fc563c903e2b973d79f9644b82 (diff)
parent877ef0594d94f48bf063446b1f8a4b5e1941a8cd (diff)
Merge 5.9 into 5.9.0v5.9.0-beta4
Diffstat (limited to 'src/corelib/kernel/qcfsocketnotifier.cpp')
-rw-r--r--src/corelib/kernel/qcfsocketnotifier.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/corelib/kernel/qcfsocketnotifier.cpp b/src/corelib/kernel/qcfsocketnotifier.cpp
index a079031e96..1fee2aa5fc 100644
--- a/src/corelib/kernel/qcfsocketnotifier.cpp
+++ b/src/corelib/kernel/qcfsocketnotifier.cpp
@@ -292,10 +292,19 @@ void QCFSocketNotifier::enableSocketNotifiers(CFRunLoopObserverRef ref, CFRunLoo
continue;
}
- if (!socketInfo->readNotifier)
+ // Apple docs say: "If a callback is automatically re-enabled,
+ // it is called every time the condition becomes true ... If a
+ // callback is not automatically re-enabled, then it gets called
+ // exactly once, and is not called again until you manually
+ // re-enable that callback by calling CFSocketEnableCallBacks()".
+ // So, we don't need to enable callbacks on registering.
+ socketInfo->readEnabled = (socketInfo->readNotifier != nullptr);
+ if (!socketInfo->readEnabled)
CFSocketDisableCallBacks(socketInfo->socket, kCFSocketReadCallBack);
- if (!socketInfo->writeNotifier)
+ socketInfo->writeEnabled = (socketInfo->writeNotifier != nullptr);
+ if (!socketInfo->writeEnabled)
CFSocketDisableCallBacks(socketInfo->socket, kCFSocketWriteCallBack);
+ continue;
}
if (socketInfo->readNotifier && !socketInfo->readEnabled) {