| 130 | } |
| 131 | |
| 132 | inline void |
| 133 | UDPPacket::setConnection(UDPConnection *c) |
| 134 | { |
| 135 | /*Code reviewed by Case Larsen. Previously, we just had |
| 136 | ink_assert(!conn). This prevents tunneling of packets |
| 137 | correctly---that is, you get packets from a server on a udp |
| 138 | conn. and want to send it to a player on another connection, the |
| 139 | assert will prevent that. The "if" clause enables correct |
| 140 | handling of the connection ref. counts in such a scenario. */ |
| 141 | |
| 142 | if (p.conn) { |
| 143 | if (p.conn == c) { |
| 144 | return; |
| 145 | } |
| 146 | p.conn->Release(); |
| 147 | p.conn = nullptr; |
| 148 | } |
| 149 | p.conn = c; |
| 150 | p.conn->AddRef(); |
| 151 | } |
| 152 | |
| 153 | inline UDPConnection * |
| 154 | UDPPacket::getConnection() |
no test coverage detected