diff options
author | eihrul <eihrul> | 2008-09-15 23:11:22 +0000 |
---|---|---|
committer | eihrul <eihrul> | 2008-09-15 23:11:22 +0000 |
commit | b846c47521bcf2978bf9f6c3a39e0e8a324664be (patch) | |
tree | 8faa2e1b7ec3d8fd8e9a18b15a21bd2c3d1eb31d /host.c | |
parent | 6cf5ada45ceaff7c56a413b9c14d602a49d1c975 (diff) | |
download | enet-b846c47521bcf2978bf9f6c3a39e0e8a324664be.tar.gz enet-b846c47521bcf2978bf9f6c3a39e0e8a324664be.zip |
added miscellaneous updates for broadcasting
Diffstat (limited to 'host.c')
-rw-r--r-- | host.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -36,9 +36,12 @@ enet_host_create (const ENetAddress * address, size_t peerCount, enet_uint32 inc host -> peers = (ENetPeer *) enet_malloc (peerCount * sizeof (ENetPeer)); memset (host -> peers, 0, peerCount * sizeof (ENetPeer)); - host -> socket = enet_socket_create (ENET_SOCKET_TYPE_DATAGRAM, address); - if (host -> socket == ENET_SOCKET_NULL) + host -> socket = enet_socket_create (ENET_SOCKET_TYPE_DATAGRAM); + if (host -> socket == ENET_SOCKET_NULL || (address != NULL && enet_socket_bind (host -> socket, address) < 0)) { + if (host -> socket != ENET_SOCKET_NULL) + enet_socket_destroy (host -> socket); + enet_free (host -> peers); enet_free (host); |