Update of /cvsroot/playerstage/code/player/libplayercore
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10388/libplayercore
Modified Files:
message.cc message.h player.h
Log Message:
added message to inform clients of queue overflows
fixed some of the replace rule logic so that the queue does not expand
indefinately
Index: player.h
===================================================================
RCS file: /cvsroot/playerstage/code/player/libplayercore/player.h,v
retrieving revision 1.147
retrieving revision 1.148
diff -C2 -d -r1.147 -r1.148
*** player.h 6 Feb 2008 19:38:36 -0000 1.147
--- player.h 9 Feb 2008 02:52:29 -0000 1.148
***************
*** 338,341 ****
--- 338,348 ----
} player_bool_t;
+ /** @brief Structure for messages returning a single integer */
+ typedef struct player_uint32
+ {
+ uint32_t value;
+ } player_uint32_t;
+
+
/** @} */
Index: message.h
===================================================================
RCS file: /cvsroot/playerstage/code/player/libplayercore/message.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** message.h 7 Dec 2007 01:50:14 -0000 1.23
--- message.h 9 Feb 2008 02:52:29 -0000 1.24
***************
*** 426,429 ****
--- 426,431 ----
/// @brief Flag that data was sent (in PULL mode)
bool data_delivered;
+ /// @brief Count of the number of messages discarded due to queue
overflow.
+ bool drop_count;
};
Index: message.cc
===================================================================
RCS file: /cvsroot/playerstage/code/player/libplayercore/message.cc,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -d -r1.33 -r1.34
*** message.cc 7 Dec 2007 02:25:20 -0000 1.33
--- message.cc 9 Feb 2008 02:52:29 -0000 1.34
***************
*** 193,196 ****
--- 193,197 ----
this->data_requested = false;
this->data_delivered = false;
+ this->drop_count = 0;
}
***************
*** 289,297 ****
(hdr->type == PLAYER_MSGTYPE_CMD))
{
! // If we're over the queue length limit, ignore the new data/cmd message
! if(this->Length >= this->Maxlen)
! return(PLAYER_PLAYER_MSG_REPLACE_RULE_IGNORE);
! else
! return(this->Replace ? PLAYER_PLAYER_MSG_REPLACE_RULE_REPLACE :
PLAYER_PLAYER_MSG_REPLACE_RULE_ACCEPT);
}
else
--- 290,294 ----
(hdr->type == PLAYER_MSGTYPE_CMD))
{
! return(this->Replace ? PLAYER_PLAYER_MSG_REPLACE_RULE_REPLACE :
PLAYER_PLAYER_MSG_REPLACE_RULE_ACCEPT);
}
else
***************
*** 471,476 ****
// Should we try to replace an older message of the same signature?
int replaceOp = this->CheckReplace(hdr);
! if (replaceOp == PLAYER_PLAYER_MSG_REPLACE_RULE_IGNORE)
{
this->Unlock();
return(true);
--- 468,484 ----
// Should we try to replace an older message of the same signature?
int replaceOp = this->CheckReplace(hdr);
! // if our queue is over size discard any data or command packets
! // if we discard requests or replies this will potentially lock up the
client so we will let those through
! if (PLAYER_PLAYER_MSG_REPLACE_RULE_IGNORE == replaceOp)
{
+ // drop silently
+ this->Unlock();
+ return(true);
+ }
+ if (PLAYER_PLAYER_MSG_REPLACE_RULE_ACCEPT == replaceOp && (hdr->type ==
PLAYER_MSGTYPE_DATA ||
+ hdr->type == PLAYER_MSGTYPE_CMD) && this->Length >= this->Maxlen)
+ {
+ // record the fact that we are dropping a message
+ this->drop_count++;
this->Unlock();
return(true);
***************
*** 562,567 ****
syncHeader.addr.index = 0;
syncHeader.type = PLAYER_MSGTYPE_SYNCH;
! syncHeader.subtype = 0;
! Message* syncMessage = new Message(syncHeader, 0, 0);
this->SetDataRequested(false,true);
Unlock();
--- 570,586 ----
syncHeader.addr.index = 0;
syncHeader.type = PLAYER_MSGTYPE_SYNCH;
! // flag the synch with overflow subtype and count if an overflow occured
! Message* syncMessage = NULL;
! if (this->drop_count == 0)
! {
! syncHeader.subtype = PLAYER_PLAYER_SYNCH_OK;
! syncMessage = new Message(syncHeader, 0, 0);
! }
! else
! {
! syncHeader.subtype = PLAYER_PLAYER_SYNCH_OVERFLOW;
! syncMessage = new Message(syncHeader, &this->drop_count, true);
! this->drop_count = 0;
! }
this->SetDataRequested(false,true);
Unlock();
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit