Update of /cvsroot/playerstage/code/player/libplayercore
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19444/libplayercore
Modified Files:
message.cc message.h
Log Message:
fixed up message delivery semantics
Index: message.cc
===================================================================
RCS file: /cvsroot/playerstage/code/player/libplayercore/message.cc,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** message.cc 2 Nov 2007 02:41:11 -0000 1.29
--- message.cc 2 Nov 2007 18:09:20 -0000 1.30
***************
*** 192,195 ****
--- 192,196 ----
this->replaceRules = NULL;
this->pull = true;
+ this->data_requested = false;
}
***************
*** 367,370 ****
--- 368,372 ----
{
MessageQueueElement *current;
+ bool dataready=false;
if (!pull)
***************
*** 375,392 ****
for (current = head; current != NULL; current = current->next)
{
! current->msg->SetReady ();
}
Unlock ();
! // Push a sync message onto the end
! struct player_msghdr syncHeader;
! syncHeader.addr.host = 0;
! syncHeader.addr.robot = 0;
! syncHeader.addr.interf = PLAYER_PLAYER_CODE;
! syncHeader.addr.index = 0;
! syncHeader.type = PLAYER_MSGTYPE_SYNCH;
! syncHeader.subtype = 0;
! Message syncMessage (syncHeader, 0, 0);
! syncMessage.SetReady ();
! Push (syncMessage, true);
}
--- 377,406 ----
for (current = head; current != NULL; current = current->next)
{
! player_msghdr_t* hdr;
! hdr = current->msg->GetHeader();
! // Only need to mark data and command messages. Requests and replies
! // get marked as they are pushed in
! if((hdr->type == PLAYER_MSGTYPE_DATA) || (hdr->type ==
PLAYER_MSGTYPE_CMD))
! {
! current->msg->SetReady ();
! dataready=true;
! }
}
Unlock ();
! // Only if there was at least one message, push a sync message onto the end
! if(dataready)
! {
! struct player_msghdr syncHeader;
! syncHeader.addr.host = 0;
! syncHeader.addr.robot = 0;
! syncHeader.addr.interf = PLAYER_PLAYER_CODE;
! syncHeader.addr.index = 0;
! syncHeader.type = PLAYER_MSGTYPE_SYNCH;
! syncHeader.subtype = 0;
! Message syncMessage (syncHeader, 0, 0);
! syncMessage.SetReady ();
! this->data_requested = false;
! Push (syncMessage, true);
! }
}
***************
*** 458,462 ****
newelt->msg->GetHeader ()->type != PLAYER_MSGTYPE_CMD))
{
! // If not in pull mode, or message is not data, set ready to true
immediatly
newelt->msg->SetReady ();
}
--- 472,476 ----
newelt->msg->GetHeader ()->type != PLAYER_MSGTYPE_CMD))
{
! // If not in pull mode, or message is not data/cmd, set ready to true
immediatly
newelt->msg->SetReady ();
}
***************
*** 477,480 ****
--- 491,498 ----
if(!this->filter_on || this->Filter(msg))
this->DataAvailable();
+
+ // If the client has a pending request for data, try to fulfill it
+ if(this->pull && this->data_requested)
+ this->MarkAllReady();
return(true);
}
Index: message.h
===================================================================
RCS file: /cvsroot/playerstage/code/player/libplayercore/message.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** message.h 21 Sep 2007 03:31:50 -0000 1.21
--- message.h 2 Nov 2007 18:09:20 -0000 1.22
***************
*** 386,389 ****
--- 386,392 ----
/// @brief Get current length of queue, in elements.
size_t GetLength(void);
+
+ /// @brief Set the data_requested flag
+ void SetDataRequested(bool d) { this->data_requested = d; }
private:
/// @brief Lock the mutex associated with this queue.
***************
*** 422,425 ****
--- 425,431 ----
/// but pull is the recommended method to avoid getting delays in data on
the client.
bool pull;
+ /// @brief Flag for data was requested (in PULL mode), but none has yet
+ /// been delivered
+ bool data_requested;
};
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit