diff options
author | eihrul <eihrul> | 2010-05-06 13:44:47 +0000 |
---|---|---|
committer | eihrul <eihrul> | 2010-05-06 13:44:47 +0000 |
commit | 25c8948745a2b0b4697123acb05da9a0a829965b (patch) | |
tree | f8a328d0a942eca319286823a6d3dec74e057787 /protocol.c | |
parent | 41ccbd2f3f5fca4e427aa99c3b06a573eabb7853 (diff) | |
download | enet-25c8948745a2b0b4697123acb05da9a0a829965b.tar.gz enet-25c8948745a2b0b4697123acb05da9a0a829965b.zip |
ensure fragment outgoing commands are allocated atomically with respect to failure
Diffstat (limited to 'protocol.c')
-rw-r--r-- | protocol.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -398,10 +398,10 @@ enet_protocol_handle_send_reliable (ENetHost * host, ENetPeer * peer, const ENet packet = enet_packet_create ((const enet_uint8 *) command + sizeof (ENetProtocolSendReliable), dataLength, ENET_PACKET_FLAG_RELIABLE); - if (packet == NULL) + if (packet == NULL || + enet_peer_queue_incoming_command (peer, command, packet, 0) == NULL) return -1; - enet_peer_queue_incoming_command (peer, command, packet, 0); return 0; } @@ -445,12 +445,12 @@ enet_protocol_handle_send_unsequenced (ENetHost * host, ENetPeer * peer, const E packet = enet_packet_create ((const enet_uint8 *) command + sizeof (ENetProtocolSendUnsequenced), dataLength, ENET_PACKET_FLAG_UNSEQUENCED); - if (packet == NULL) + if (packet == NULL || + enet_peer_queue_incoming_command (peer, command, packet, 0) == NULL) return -1; peer -> unsequencedWindow [index / 32] |= 1 << (index % 32); - enet_peer_queue_incoming_command (peer, command, packet, 0); return 0; } @@ -472,10 +472,10 @@ enet_protocol_handle_send_unreliable (ENetHost * host, ENetPeer * peer, const EN packet = enet_packet_create ((const enet_uint8 *) command + sizeof (ENetProtocolSendUnreliable), dataLength, 0); - if (packet == NULL) + if (packet == NULL || + enet_peer_queue_incoming_command (peer, command, packet, 0) == NULL) return -1; - enet_peer_queue_incoming_command (peer, command, packet, 0); return 0; } |