diff options
Diffstat (limited to 'peer.c')
-rw-r--r-- | peer.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -2,6 +2,7 @@ @file peer.c @brief ENet peer management functions */ +#include <string.h> #define ENET_BUILDING_LIB 1 #include "enet/enet.h" @@ -379,6 +380,7 @@ enet_peer_reset (ENetPeer * peer) peer -> windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE; peer -> incomingUnsequencedGroup = 0; peer -> outgoingUnsequencedGroup = 0; + peer -> disconnectData = 0; memset (peer -> unsequencedWindow, 0, sizeof (peer -> unsequencedWindow)); @@ -410,12 +412,13 @@ enet_peer_ping (ENetPeer * peer) /** Force an immediate disconnection from a peer. @param peer peer to disconnect + @param data data describing the disconnection @remarks No ENET_EVENT_DISCONNECT event will be generated. The foreign peer is not guarenteed to receive the disconnect notification, and is reset immediately upon return from this function. */ void -enet_peer_disconnect_now (ENetPeer * peer) +enet_peer_disconnect_now (ENetPeer * peer, enet_uint32 data) { ENetProtocol command; @@ -431,6 +434,7 @@ enet_peer_disconnect_now (ENetPeer * peer) command.header.channelID = 0xFF; command.header.flags = ENET_PROTOCOL_FLAG_UNSEQUENCED; command.header.commandLength = sizeof (ENetProtocolDisconnect); + command.disconnect.data = data; enet_peer_queue_outgoing_command (peer, & command, NULL, 0, 0); @@ -442,11 +446,12 @@ enet_peer_disconnect_now (ENetPeer * peer) /** Request a disconnection from a peer. @param peer peer to request a disconnection + @param data data describing the disconnection @remarks An ENET_EVENT_DISCONNECT event will be generated by enet_host_service() once the disconnection is complete. */ void -enet_peer_disconnect (ENetPeer * peer) +enet_peer_disconnect (ENetPeer * peer, enet_uint32 data) { ENetProtocol command; @@ -461,6 +466,7 @@ enet_peer_disconnect (ENetPeer * peer) command.header.channelID = 0xFF; command.header.flags = ENET_PROTOCOL_FLAG_UNSEQUENCED; command.header.commandLength = sizeof (ENetProtocolDisconnect); + command.disconnect.data = data; if (peer -> state == ENET_PEER_STATE_CONNECTED) command.header.flags = ENET_PROTOCOL_FLAG_ACKNOWLEDGE; |