Properly check return value of createDatagramSocket.

This commit is contained in:
Sönke Ludwig 2017-01-30 11:19:51 +01:00
parent 8f6c4dd536
commit 4c9b6c0fb8
No known key found for this signature in database
GPG key ID: D95E8DB493EE314C

View file

@ -700,6 +700,7 @@ struct UDPConnection {
private this(ref NetworkAddress bind_address)
{
m_socket = eventDriver.sockets.createDatagramSocket(bind_address.toUnknownAddress(), null);
enforce(m_socket != DatagramSocketFD.invalid, "Failed to create datagram socket.");
m_context = () @trusted { return &eventDriver.core.userData!Context(m_socket); } ();
m_context.localAddress = bind_address;
}