Browse Source

cmRtNet.h/c : Sync. messages are now transmitted to the client

in _cmRtNetRecv().
Added comments.
master
Kevin Larke 10 years ago
parent
commit
4df91dd08f
2 changed files with 6 additions and 2 deletions
  1. 3
    1
      cmRtNet.c
  2. 3
    1
      cmRtNet.h

+ 3
- 1
cmRtNet.c View File

@@ -608,13 +608,14 @@ cmRtNetRC_t  _cmRtNetSyncModeRecv( cmRtNet_t* p, const char* data, unsigned data
608 608
   return rc;
609 609
 }
610 610
 
611
+// This is called in the context of cmRtNetReceive().
611 612
 void _cmRtNetRecv( void* cbArg, const char* data, unsigned dataByteCnt, const struct sockaddr_in* fromAddr )
612 613
 {
613 614
   cmRtNet_t* p = (cmRtNet_t*)cbArg;
614 615
   
615 616
   if( _cmRtNetIsSyncModeMsg(data,dataByteCnt))
616 617
     _cmRtNetSyncModeRecv(p,data,dataByteCnt,fromAddr);
617
-  else
618
+  // else
618 619
     p->cbFunc(p->cbArg,data,dataByteCnt,fromAddr);
619 620
   
620 621
 }
@@ -707,6 +708,7 @@ cmRtNetRC_t cmRtNetReceive( cmRtNetH_t h )
707 708
   cmRtNetRC_t rc = kOkNetRC;
708 709
   cmRtNet_t*  p  = _cmRtNetHandleToPtr(h);
709 710
 
711
+  // Calling this function results in callbacks to _cmRtNetRecv() (above)
710 712
   if( cmUdpGetAvailData(p->udpH, NULL, NULL, NULL ) != kOkUdpRC )
711 713
   {
712 714
     cmErrMsg(&p->err,kUdpPortFailNetRC,"UDP port query failed.");

+ 3
- 1
cmRtNet.h View File

@@ -65,7 +65,9 @@ extern "C" {
65 65
   cmRtNetRC_t cmRtNetDoSync( cmRtNetH_t h );
66 66
 
67 67
   // This function must be polled to receive incoming network messages
68
-  // via the callback funcion 'cbFunc' as passed to cmRtNetAlloc()
68
+  // via the callback funcion 'cbFunc' as passed to cmRtNetAlloc().
69
+  // Note that all messages received via 'cbFunc' will be prefixed with
70
+  // an cmRtNetMsg_t header (See cmRtSysMsg.h).
69 71
   cmRtNetRC_t cmRtNetReceive( cmRtNetH_t h );
70 72
 
71 73
   // Get an end point handle for use with cmRtNetSend.

Loading…
Cancel
Save