Logo Search packages:      
Sourcecode: egoboo version File versions  Download package

void enet_peer_disconnect_now ( ENetPeer peer  ) 

Force an immediate disconnection from a peer.

Parameters:
peer peer to disconnect
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.

Definition at line 399 of file peer.c.

References enet_host_flush(), and enet_peer_reset().

{
    ENetProtocol command;

    if (peer -> state != ENET_PEER_STATE_DISCONNECTED)
      return;

    if (peer -> state != ENET_PEER_STATE_ZOMBIE &&
        peer -> state != ENET_PEER_STATE_DISCONNECTING)
    {
        enet_peer_reset_queues (peer);

        command.header.command = ENET_PROTOCOL_COMMAND_DISCONNECT;
        command.header.channelID = 0xFF;
        command.header.flags = 0;
        command.header.commandLength = sizeof (ENetProtocolDisconnect);

        enet_peer_queue_outgoing_command (peer, & command, NULL, 0, 0);

        enet_host_flush (peer -> host);
    }

    enet_peer_reset (peer);
}


Generated by  Doxygen 1.6.0   Back to index