From 4df91dd08f697f93720983d87e1709a981076e5f Mon Sep 17 00:00:00 2001 From: Kevin Larke Date: Sat, 14 Jun 2014 13:54:30 -0700 Subject: [PATCH] cmRtNet.h/c : Sync. messages are now transmitted to the client in _cmRtNetRecv(). Added comments. --- cmRtNet.c | 4 +++- cmRtNet.h | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cmRtNet.c b/cmRtNet.c index 960b4d5..1ecdfc2 100644 --- a/cmRtNet.c +++ b/cmRtNet.c @@ -608,13 +608,14 @@ cmRtNetRC_t _cmRtNetSyncModeRecv( cmRtNet_t* p, const char* data, unsigned data return rc; } +// This is called in the context of cmRtNetReceive(). void _cmRtNetRecv( void* cbArg, const char* data, unsigned dataByteCnt, const struct sockaddr_in* fromAddr ) { cmRtNet_t* p = (cmRtNet_t*)cbArg; if( _cmRtNetIsSyncModeMsg(data,dataByteCnt)) _cmRtNetSyncModeRecv(p,data,dataByteCnt,fromAddr); - else + // else p->cbFunc(p->cbArg,data,dataByteCnt,fromAddr); } @@ -707,6 +708,7 @@ cmRtNetRC_t cmRtNetReceive( cmRtNetH_t h ) cmRtNetRC_t rc = kOkNetRC; cmRtNet_t* p = _cmRtNetHandleToPtr(h); + // Calling this function results in callbacks to _cmRtNetRecv() (above) if( cmUdpGetAvailData(p->udpH, NULL, NULL, NULL ) != kOkUdpRC ) { cmErrMsg(&p->err,kUdpPortFailNetRC,"UDP port query failed."); diff --git a/cmRtNet.h b/cmRtNet.h index d29f53e..06bda20 100644 --- a/cmRtNet.h +++ b/cmRtNet.h @@ -65,7 +65,9 @@ extern "C" { cmRtNetRC_t cmRtNetDoSync( cmRtNetH_t h ); // This function must be polled to receive incoming network messages - // via the callback funcion 'cbFunc' as passed to cmRtNetAlloc() + // via the callback funcion 'cbFunc' as passed to cmRtNetAlloc(). + // Note that all messages received via 'cbFunc' will be prefixed with + // an cmRtNetMsg_t header (See cmRtSysMsg.h). cmRtNetRC_t cmRtNetReceive( cmRtNetH_t h ); // Get an end point handle for use with cmRtNetSend.