From: <dm...@us...> - 2012-03-05 10:08:32
|
Revision: 1349 http://teenylime.svn.sourceforge.net/teenylime/?rev=1349&view=rev Author: dmolt Date: 2012-03-05 10:08:26 +0000 (Mon, 05 Mar 2012) Log Message: ----------- add #if MAX_PENDINGS > 0 to enable/disable remote query queue (this check avoid warnings) Modified Paths: -------------- branches/tinyos-2.x-tmote-preproc/tl/system/DistributedTeenyLime.nc Modified: branches/tinyos-2.x-tmote-preproc/tl/system/DistributedTeenyLime.nc =================================================================== --- branches/tinyos-2.x-tmote-preproc/tl/system/DistributedTeenyLime.nc 2011-12-13 17:09:05 UTC (rev 1348) +++ branches/tinyos-2.x-tmote-preproc/tl/system/DistributedTeenyLime.nc 2012-03-05 10:08:26 UTC (rev 1349) @@ -113,7 +113,7 @@ STARTED = 1, IN_PROGRESS = 2, } opStatus; - + // Data structure for pending remote operations typedef struct { bool empty; @@ -127,7 +127,9 @@ char tuple_data[SLAB_SIZE]; char *new_tuple; } pendingOp; +#if MAX_PENDING_OPS > 0 pendingOp pendingOps[MAX_PENDING_OPS]; +#endif // Data structure for maintaining the neighbor set TLTarget_t neighborsId[MAX_NEIGHBORS]; @@ -287,6 +289,7 @@ } +#if MAX_PENDING_OPS > 0 void addResultTuples(uint8_t commandId, tuple *tuples, uint8_t number) { uint8_t i,j; @@ -383,15 +386,18 @@ return FALSE; } } +#endif //MAX_PENDING_OPS > 0 command error_t Init.init() { uint8_t i; - + +#if MAX_PENDING_OPS > 0 for (i=0; i<MAX_PENDING_OPS; i++) { pendingOps[i].empty = TRUE; } +#endif #ifdef REMOTE_REACTIONS numberActiveReactions = 0; @@ -435,11 +441,14 @@ if (operationId.reliable && target == TL_NEIGHBORHOOD) { call TLDebug.triggerErr(UNSUPPORTED_RELIABLE_OP); +#if MAX_PENDING_OPS > 0 } else { atomic { + addPendingOp(operationId, TRUE, templ, target); call SendTuple.send(target, templ, 1, RD_OP, operationId); } +#endif } } @@ -449,11 +458,13 @@ if (operationId.reliable && target == TL_NEIGHBORHOOD) { call TLDebug.triggerErr(UNSUPPORTED_RELIABLE_OP); +#if MAX_PENDING_OPS > 0 } else { atomic { addPendingOp(operationId, TRUE, templ, target); call SendTuple.send(target, templ, 1, IN_OP, operationId); } +#endif } } @@ -463,11 +474,13 @@ if (operationId.reliable && target == TL_NEIGHBORHOOD) { call TLDebug.triggerErr(UNSUPPORTED_RELIABLE_OP); +#if MAX_PENDING_OPS > 0 } else{ atomic { addPendingOp(operationId, FALSE, templ, target); call SendTuple.send(target, templ, 1, RDG_OP, operationId); } +#endif } } @@ -477,11 +490,13 @@ if (operationId.reliable && target == TL_NEIGHBORHOOD) { call TLDebug.triggerErr(UNSUPPORTED_RELIABLE_OP); +#if MAX_PENDING_OPS > 0 } else { atomic { addPendingOp(operationId, FALSE, templ, target); call SendTuple.send(target, templ, 1, ING_OP, operationId); } +#endif } } @@ -532,13 +547,14 @@ } event void RemoteOpsTimer.fired() { - +#if MAX_PENDING_OPS > 0 atomic { uint8_t i; bool needRescheduling = FALSE; // Signaling expired operations + for (i=0; i<MAX_PENDING_OPS; i++) { if (!pendingOps[i].empty && pendingOps[i].countDown == 0) { @@ -581,6 +597,7 @@ #endif } } +#endif //MAX_PENDING_OPS > 0 } event void BridgeTupleSpace.timeTick() { @@ -653,10 +670,12 @@ refreshInstalledReaction(operationId); break; #endif - + +#if MAX_PENDING_OPS > 0 case QUERY_RESULT: addResultTuples(operationId.commandId, tuples, tupleNumber); break; +#endif #ifdef REMOTE_REACTIONS case REACTION_FIRING: @@ -726,13 +745,16 @@ TLOpId_t operationId, TLTarget_t target, tuple* returningTuple){ +#if MAX_PENDING_OPS > 0 uint8_t i; +#endif signal DistributedTupleSpace.operationCompleted(completionCode, operationId, target, returningTuple); +#if MAX_PENDING_OPS > 0 // Checking if it is a query operation and the request message was not delivered for (i=0; i<MAX_PENDING_OPS; i++) { if (!pendingOps[i].empty @@ -748,6 +770,7 @@ break; } } +#endif //MAX_PENDING_OPS > 0 } #if defined(PLATFORM_TELOSB) || defined(PLATFORM_TREMATEB) || defined(TOSSIM) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |