called with continuation lock taken out We call Release because AddRef was called before entering here.
| 65 | // called with continuation lock taken out |
| 66 | // We call Release because AddRef was called before entering here. |
| 67 | int |
| 68 | UnixUDPConnection::callbackHandler(int event, void *data) |
| 69 | { |
| 70 | (void)event; |
| 71 | (void)data; |
| 72 | callbackAction = nullptr; |
| 73 | if (continuation == nullptr) { |
| 74 | return EVENT_CONT; |
| 75 | } |
| 76 | |
| 77 | if (m_errno) { |
| 78 | if (!shouldDestroy()) { |
| 79 | continuation->handleEvent(NET_EVENT_DATAGRAM_ERROR, this); |
| 80 | } |
| 81 | destroy(); // don't destroy until after calling back with error |
| 82 | Release(); |
| 83 | return EVENT_CONT; |
| 84 | } else { |
| 85 | UDPPacket *p = nullptr; |
| 86 | SList(UDPPacket, alink) aq(inQueue.popall()); |
| 87 | |
| 88 | Dbg(dbg_ctl_udpnet, "UDPConnection::callbackHandler"); |
| 89 | Queue<UDPPacket> result; |
| 90 | while ((p = aq.pop())) { |
| 91 | result.push(p); |
| 92 | } |
| 93 | |
| 94 | if (!shouldDestroy()) { |
| 95 | continuation->handleEvent(NET_EVENT_DATAGRAM_READ_READY, &result); |
| 96 | } else { |
| 97 | while ((p = result.dequeue())) { |
| 98 | p->free(); |
| 99 | } |
| 100 | } |
| 101 | } |
| 102 | Release(); |
| 103 | return EVENT_CONT; |
| 104 | } |
| 105 | |
| 106 | void |
| 107 | UDPConnection::bindToThread(Continuation *c, EThread *t) |
no test coverage detected