| 225 | #endif // USE_UPNP |
| 226 | |
| 227 | static void ThreadMapPort() |
| 228 | { |
| 229 | SetSyscallSandboxPolicy(SyscallSandboxPolicy::INITIALIZATION_MAP_PORT); |
| 230 | bool ok; |
| 231 | do { |
| 232 | ok = false; |
| 233 | |
| 234 | #ifdef USE_UPNP |
| 235 | // High priority protocol. |
| 236 | if (g_mapport_enabled_protos & MapPortProtoFlag::UPNP) { |
| 237 | g_mapport_current_proto = MapPortProtoFlag::UPNP; |
| 238 | ok = ProcessUpnp(); |
| 239 | if (ok) continue; |
| 240 | } |
| 241 | #endif // USE_UPNP |
| 242 | |
| 243 | #ifdef USE_NATPMP |
| 244 | // Low priority protocol. |
| 245 | if (g_mapport_enabled_protos & MapPortProtoFlag::NAT_PMP) { |
| 246 | g_mapport_current_proto = MapPortProtoFlag::NAT_PMP; |
| 247 | ok = ProcessNatpmp(); |
| 248 | if (ok) continue; |
| 249 | } |
| 250 | #endif // USE_NATPMP |
| 251 | |
| 252 | g_mapport_current_proto = MapPortProtoFlag::NONE; |
| 253 | if (g_mapport_enabled_protos == MapPortProtoFlag::NONE) { |
| 254 | return; |
| 255 | } |
| 256 | |
| 257 | } while (ok || g_mapport_interrupt.sleep_for(PORT_MAPPING_RETRY_PERIOD)); |
| 258 | } |
| 259 | |
| 260 | void StartThreadMapPort() |
| 261 | { |
nothing calls this directly
no test coverage detected