Don't assume socket creation is always succeed (not when using torsocks)

This commit is contained in:
Benau 2018-10-07 10:15:58 +08:00
parent fdfaa62a09
commit a8b1c54092

View File

@ -71,6 +71,8 @@ Network::Network(int peer_count, int channel_limit,
// Any port // Any port
new_addr.port = 0; new_addr.port = 0;
m_host = enet_host_create(&new_addr, peer_count, channel_limit, 0, 0); m_host = enet_host_create(&new_addr, peer_count, channel_limit, 0, 0);
if (!m_host)
Log::fatal("Network", "Failed to create socket with any port.");
} }
} // Network } // Network