| 183 | } |
| 184 | |
| 185 | RelaySocket* RelayServer::createSocket(set<RelaySocket*,Compare>::const_iterator& it,UInt16 port) const { |
| 186 | SocketAddress address(IPAddress::Wildcard(), port); |
| 187 | Exception ex; |
| 188 | RelaySocket* pSocket = new RelaySocket(_manager,port); |
| 189 | if (!pSocket->bind(ex, address)) { |
| 190 | delete pSocket; |
| 191 | DEBUG("Turn listening impossible on ", port, " port, ", ex.error()) |
| 192 | return NULL; |
| 193 | } |
| 194 | if (ex) |
| 195 | WARN("Turn server listening on ", port, " port, ", ex.error()) |
| 196 | else |
| 197 | INFO("Turn server listening on ", port, " port") |
| 198 | _sockets.emplace_hint(it, pSocket); |
| 199 | return pSocket; |
| 200 | } |
| 201 | |
| 202 | void RelayServer::manage() const { |
| 203 | auto it = _sockets.begin(); |