| 40 | } // end anonymous namespace |
| 41 | |
| 42 | UnixUDPConnection::~UnixUDPConnection() |
| 43 | { |
| 44 | UDPPacket *p = nullptr; |
| 45 | |
| 46 | SList(UDPPacket, alink) aq(inQueue.popall()); |
| 47 | |
| 48 | if (!tobedestroyed) { |
| 49 | tobedestroyed = 1; |
| 50 | } |
| 51 | |
| 52 | while ((p = aq.pop())) { |
| 53 | p->free(); |
| 54 | } |
| 55 | if (callbackAction) { |
| 56 | callbackAction->cancel(); |
| 57 | callbackAction = nullptr; |
| 58 | } |
| 59 | Dbg(dbg_ctl_udpnet, "Destroying udp port = %d", getPortNum()); |
| 60 | if (sock.is_ok()) { |
| 61 | sock.close(); |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | // called with continuation lock taken out |
| 66 | // We call Release because AddRef was called before entering here. |