aboutsummaryrefslogtreecommitdiffhomepage
path: root/peer.c
diff options
context:
space:
mode:
authoreihrul <eihrul>2006-03-14 23:21:50 +0000
committereihrul <eihrul>2006-03-14 23:21:50 +0000
commit550d23e25d731abf9c8d400b5ef45b00b0cd2f1e (patch)
tree2ddb0715e0f9cc0d269b07a2977a073949d482a8 /peer.c
parent102f1e22cf02bb19ef53a824e31d34c766ebb2a7 (diff)
downloadenet-550d23e25d731abf9c8d400b5ef45b00b0cd2f1e.tar.gz
enet-550d23e25d731abf9c8d400b5ef45b00b0cd2f1e.zip
1.0 stuff
Diffstat (limited to 'peer.c')
-rw-r--r--peer.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/peer.c b/peer.c
index 2689e15..754239f 100644
--- a/peer.c
+++ b/peer.c
@@ -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;