Properly check return value of createDatagramSocket.
This commit is contained in:
parent
8f6c4dd536
commit
4c9b6c0fb8
|
@ -700,6 +700,7 @@ struct UDPConnection {
|
||||||
private this(ref NetworkAddress bind_address)
|
private this(ref NetworkAddress bind_address)
|
||||||
{
|
{
|
||||||
m_socket = eventDriver.sockets.createDatagramSocket(bind_address.toUnknownAddress(), null);
|
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 = () @trusted { return &eventDriver.core.userData!Context(m_socket); } ();
|
||||||
m_context.localAddress = bind_address;
|
m_context.localAddress = bind_address;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue