| 
					
				 | 
			
			
				@@ -32,6 +32,30 @@ enet_protocol_command_size (enet_uint8 commandNumber) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     return commandSizes [commandNumber & ENET_PROTOCOL_COMMAND_MASK]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+static void 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+enet_protocol_change_state (ENetHost * host, ENetPeer * peer, ENetPeerState state) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if (state == ENET_PEER_STATE_CONNECTED || state == ENET_PEER_STATE_DISCONNECT_LATER) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      enet_peer_on_connect (peer); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      enet_peer_on_disconnect (peer); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    peer -> state = state; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+static void 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+enet_protocol_dispatch_state (ENetHost * host, ENetPeer * peer, ENetPeerState state) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    enet_peer_change_state (host, peer, state); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if (! peer -> needsDispatch) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+       enet_list_insert (enet_list_end (& host -> dispatchQueue), & peer -> dispatchList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+       peer -> needsDispatch = 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 static int 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 enet_protocol_dispatch_incoming_commands (ENetHost * host, ENetEvent * event) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -45,7 +69,7 @@ enet_protocol_dispatch_incoming_commands (ENetHost * host, ENetEvent * event) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        case ENET_PEER_STATE_CONNECTION_PENDING: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        case ENET_PEER_STATE_CONNECTION_SUCCEEDED: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-           peer -> state = ENET_PEER_STATE_CONNECTED; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+           enet_protocol_change_state (host, peer, ENET_PEER_STATE_CONNECTED); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            event -> type = ENET_EVENT_TYPE_CONNECT; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            event -> peer = peer; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -92,19 +116,6 @@ enet_protocol_dispatch_incoming_commands (ENetHost * host, ENetEvent * event) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     return 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-static void 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-enet_protocol_dispatch_state (ENetHost * host, ENetPeer * peer, ENetPeerState state) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    peer -> state = state; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    if (! peer -> needsDispatch) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-       enet_list_insert (enet_list_end (& host -> dispatchQueue), & peer -> dispatchList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-       peer -> needsDispatch = 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    }     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 static void 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 enet_protocol_notify_connect (ENetHost * host, ENetPeer * peer, ENetEvent * event) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -112,7 +123,7 @@ enet_protocol_notify_connect (ENetHost * host, ENetPeer * peer, ENetEvent * even 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (event != NULL) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        peer -> state = ENET_PEER_STATE_CONNECTED; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        enet_protocol_change_state (host, peer, ENET_PEER_STATE_CONNECTED); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         event -> type = ENET_EVENT_TYPE_CONNECT; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         event -> peer = peer; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -762,9 +773,15 @@ enet_protocol_handle_bandwidth_limit (ENetHost * host, ENetPeer * peer, const EN 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       return -1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if (peer -> incomingBandwidth != 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      -- host -> bandwidthLimitedPeers; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     peer -> incomingBandwidth = ENET_NET_TO_HOST_32 (command -> bandwidthLimit.incomingBandwidth); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     peer -> outgoingBandwidth = ENET_NET_TO_HOST_32 (command -> bandwidthLimit.outgoingBandwidth); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if (peer -> incomingBandwidth != 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      ++ host -> bandwidthLimitedPeers; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (peer -> incomingBandwidth == 0 && host -> outgoingBandwidth == 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       peer -> windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     else 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -812,7 +829,7 @@ enet_protocol_handle_disconnect (ENetHost * host, ENetPeer * peer, const ENetPro 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (command -> header.command & ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      peer -> state = ENET_PEER_STATE_ACKNOWLEDGING_DISCONNECT; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      enet_protocol_change_state (host, peer, ENET_PEER_STATE_ACKNOWLEDGING_DISCONNECT); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       enet_protocol_dispatch_state (host, peer, ENET_PEER_STATE_ZOMBIE); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 |