aboutsummaryrefslogtreecommitdiffhomepage
path: root/protocol.c
diff options
context:
space:
mode:
authorlsalzman <[email protected]>2012-10-02 13:33:07 +0300
committerlsalzman <[email protected]>2012-10-02 13:33:07 +0300
commit2d979ceb5111faafd2bc78dbaa8893ac36931875 (patch)
tree11bc36efd1de9041388ed3d7baeb701e54ad3ddd /protocol.c
parent9dff8f72cfaae437a2e208338dd14544dbc20d02 (diff)
downloadenet-2d979ceb5111faafd2bc78dbaa8893ac36931875.tar.gz
enet-2d979ceb5111faafd2bc78dbaa8893ac36931875.zip
intercept callback support
Diffstat (limited to 'protocol.c')
-rw-r--r--protocol.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/protocol.c b/protocol.c
index 2563513..c8c54fd 100644
--- a/protocol.c
+++ b/protocol.c
@@ -1194,7 +1194,25 @@ enet_protocol_receive_incoming_commands (ENetHost * host, ENetEvent * event)
host -> totalReceivedData += receivedLength;
host -> totalReceivedPackets ++;
-
+
+ if (host -> intercept != NULL)
+ {
+ switch (host -> intercept (host, event))
+ {
+ case 1:
+ if (event != NULL && event -> type != ENET_EVENT_TYPE_NONE)
+ return 1;
+
+ continue;
+
+ case -1:
+ return -1;
+
+ default:
+ break;
+ }
+ }
+
switch (enet_protocol_handle_incoming_commands (host, event))
{
case 1: