| 37 | } |
| 38 | |
| 39 | int AcquirePort(Socket& sock, unsigned int port){ |
| 40 | if(port > PORT_MAX){ |
| 41 | Log::Warning("[Network] AcquirePort: Invalid port: %d", port); |
| 42 | return -1; |
| 43 | } |
| 44 | |
| 45 | if(ports[port]){ |
| 46 | Log::Warning("[Network] AcquirePort: Port %d in use!", port); |
| 47 | return -2; |
| 48 | } |
| 49 | |
| 50 | ports[port] = &sock; |
| 51 | |
| 52 | return 0; |
| 53 | } |
| 54 | |
| 55 | void ReleasePort(unsigned short port){ |
| 56 | assert(port <= PORT_MAX); |
no test coverage detected