Fix potential access of an invalid waiter queue.
This commit is contained in:
parent
2f03f8dd42
commit
1f9a99a805
|
@ -114,6 +114,10 @@ final class PosixEventDriverEvents(Loop : PosixEventLoop, Sockets : EventDriverS
|
||||||
{
|
{
|
||||||
if (!isValid(event)) return;
|
if (!isValid(event)) return;
|
||||||
|
|
||||||
|
// make sure the event stays alive until all waiters have been notified.
|
||||||
|
addRef(event);
|
||||||
|
scope (exit) releaseRef(event);
|
||||||
|
|
||||||
auto slot = getSlot(event);
|
auto slot = getSlot(event);
|
||||||
if (notify_all) {
|
if (notify_all) {
|
||||||
//log("emitting only for this thread (%s waiters)", m_fds[event].waiters.length);
|
//log("emitting only for this thread (%s waiters)", m_fds[event].waiters.length);
|
||||||
|
@ -167,9 +171,12 @@ final class PosixEventDriverEvents(Loop : PosixEventLoop, Sockets : EventDriverS
|
||||||
trigger(event, cnt > 0);
|
trigger(event, cnt > 0);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
private void onSocketData(DatagramSocketFD s, IOStatus, size_t, scope RefAddress)
|
private void onSocketData(DatagramSocketFD s, IOStatus st, size_t, scope RefAddress)
|
||||||
@nogc {
|
@nogc {
|
||||||
m_sockets.receiveNoGC(s, m_buf, IOMode.once, &onSocketData);
|
// avoid infinite recursion in case of errors
|
||||||
|
if (st == IOStatus.ok)
|
||||||
|
m_sockets.receiveNoGC(s, m_buf, IOMode.once, &onSocketData);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
EventID evt = m_sockets.userData!EventID(s);
|
EventID evt = m_sockets.userData!EventID(s);
|
||||||
scope doit = {
|
scope doit = {
|
||||||
|
|
Loading…
Reference in a new issue