[Tinyos-contrib-commits] CVS: tinyos-1.x/contrib/wustl/apps/Agilla/components RemoteTSOpMgrM.nc, 1.22, 1.22.2.1

Chien-Liang Fok chien-liang at users.sourceforge.net
Tue Dec 19 23:27:14 PST 2006


Update of /cvsroot/tinyos/tinyos-1.x/contrib/wustl/apps/Agilla/components
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv1266

Modified Files:
      Tag: GroupComm
	RemoteTSOpMgrM.nc 
Log Message:
Fixed a possible memory leak.  Response message to remote TS op no deallocated if response not sent.

Index: RemoteTSOpMgrM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/wustl/apps/Agilla/components/RemoteTSOpMgrM.nc,v
retrieving revision 1.22
retrieving revision 1.22.2.1
diff -C2 -d -r1.22 -r1.22.2.1
*** RemoteTSOpMgrM.nc	27 Sep 2006 04:20:32 -0000	1.22
--- RemoteTSOpMgrM.nc	20 Dec 2006 07:27:12 -0000	1.22.2.1
***************
*** 119,122 ****
--- 119,124 ----
    // Flags for the forces_uart operations 
    uint16_t _flags;
+   
+   //bool _running;  // prevents two components from issuing a remote TS op simultaneously
  
  
***************
*** 130,133 ****
--- 132,136 ----
    {
      _currAgent = NULL;
+     //_running = FALSE;
      call Leds.init();
      call Random.init();
***************
*** 149,152 ****
--- 152,156 ----
    inline result_t finish(result_t success)
    {
+     //_running = FALSE;
      signal RemoteTSOpMgrI.done(_currAgent, _dest, success);
      _currAgent = NULL;
***************
*** 157,179 ****
      return SUCCESS;
    }
  
    command result_t RemoteTSOpMgrI.execute(AgillaAgentContext* agent,
      uint16_t op, uint16_t dest, AgillaTuple tuple, uint16_t flags)
    {
!     _currAgent = agent;
!     _dest = dest;
!     _op = op;
!     _tuple = tuple;
!     _numResults = 0;
!     _numTries = 0;
!     
!     _flags = flags;
  
!     if (!post doRemoteOp())
!     {
!       dbg(DBG_USR1, "VM (%i:%i): RemoteTSOpMgrM: ERROR: Could not post doRemoteOp().\n", agent->id.id, agent->pc-1);
!       return finish(FAIL);
!     }
!     return SUCCESS;
    } // RemoteTSOpMgrI.execute()
  
--- 161,195 ----
      return SUCCESS;
    }
+   
+   /**
+    * Returns whether the remote TS Op Mgr is running.
+    * This is used to coordinate between OPrts and OPsendToGroup.
+    */
+   command result_t RemoteTSOpMgrI.isRunning() {
+     return _currAgent != NULL;
+   }
  
    command result_t RemoteTSOpMgrI.execute(AgillaAgentContext* agent,
      uint16_t op, uint16_t dest, AgillaTuple tuple, uint16_t flags)
    {
!     //if (!_running) {
!       //_running = TRUE;
!       _currAgent = agent;
!       _dest = dest;
!       _op = op;
!       _tuple = tuple;
!       _numResults = 0;
!       _numTries = 0;
  
!       _flags = flags;
! 
!       if (!post doRemoteOp())
!       {
!         dbg(DBG_USR1, "VM (%i:%i): RemoteTSOpMgrM: ERROR: Could not post doRemoteOp().\n", agent->id.id, agent->pc-1);
!         return finish(FAIL);
!       }
!       return SUCCESS;
!     //} else
!     //  return FAIL;    
    } // RemoteTSOpMgrI.execute()
  
***************
*** 258,261 ****
--- 274,278 ----
      {
        dbg(DBG_USR1, "VM (%i:%i): RemoteTSOpMgrM: doRemoteOP: ERROR: Failed to allocate free message.\n", _currAgent->id.id, _currAgent->pc-1);
+       finish(FAIL);
      }
  
***************
*** 604,608 ****
                call MessageBufferI.freeMsg(reply);
              }
!           }
          } else
          {
--- 621,626 ----
                call MessageBufferI.freeMsg(reply);
              }
!           } else
!             call MessageBufferI.freeMsg(reply); // no reply sent, free buffer
          } else
          {



More information about the Tinyos-contrib-commits mailing list