Update of /cvsroot/playerstage/code/player/client_libs/libplayerc
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21065/libplayerc
Modified Files:
client.c playerc.h
Log Message:
fixed infite loop in rare conditions where sync is recieved seperately from
data
Index: client.c
===================================================================
RCS file: /cvsroot/playerstage/code/player/client_libs/libplayerc/client.c,v
retrieving revision 1.87
retrieving revision 1.88
diff -C2 -d -r1.87 -r1.88
*** client.c 26 Nov 2007 22:14:59 -0000 1.87
--- client.c 29 Nov 2007 03:37:23 -0000 1.88
***************
*** 172,175 ****
--- 172,176 ----
client->transport = PLAYERC_TRANSPORT_TCP;
client->data_requested = 0;
+ client->data_received = 0;
client->request_timeout = 5.0;
***************
*** 513,517 ****
--- 514,521 ----
ret = playerc_client_request(client, NULL, PLAYER_PLAYER_REQ_DATA, &req,
NULL);
if(ret == 0)
+ {
client->data_requested = 1;
+ client->data_received = 0;
+ }
return(ret);
}
***************
*** 577,581 ****
void *playerc_client_read(playerc_client_t *client)
{
! void* ret;
// 10ms delay
struct timespec sleeptime = {0,10000000};
--- 581,585 ----
void *playerc_client_read(playerc_client_t *client)
{
! void* ret;
// 10ms delay
struct timespec sleeptime = {0,10000000};
***************
*** 593,597 ****
break;
nanosleep(&sleeptime,NULL);
! }
return(ret);
}
--- 597,601 ----
break;
nanosleep(&sleeptime,NULL);
! }
return(ret);
}
***************
*** 601,627 ****
{
player_msghdr_t header;
- int got_data=0;
- // See if there is any queued data.
- if (playerc_client_pop (client, &header, client->data) < 0)
- {
- // If there is no queued data, peek at the socket
- if(playerc_client_internal_peek(client,0) <= 0)
- return NULL;
- // There's data on the socket, so read a packet (blocking).
- if (playerc_client_readpacket (client, &header, client->data) < 0)
- return NULL;
- }
-
while (true)
{
// One way or another, we got a new packet into (header,client->data), so
process it
switch(header.type)
{
case PLAYER_MSGTYPE_RESP_ACK:
break;
case PLAYER_MSGTYPE_SYNCH:
client->data_requested = 0;
! if(!got_data)
return NULL;
else
--- 605,631 ----
{
player_msghdr_t header;
while (true)
{
+ // See if there is any queued data.
+ if (playerc_client_pop (client, &header, client->data) < 0)
+ {
+ // If there is no queued data, peek at the socket
+ if(playerc_client_internal_peek(client,0) <= 0)
+ return NULL;
+ // There's data on the socket, so read a packet (blocking).
+ if (playerc_client_readpacket (client, &header, client->data) < 0)
+ return NULL;
+ }
+
// One way or another, we got a new packet into (header,client->data), so
process it
switch(header.type)
{
case PLAYER_MSGTYPE_RESP_ACK:
+ PLAYERC_WARN ("Discarding unclaimed ACK");
break;
case PLAYER_MSGTYPE_SYNCH:
client->data_requested = 0;
! if(!client->data_received)
return NULL;
else
***************
*** 642,648 ****
void *result = playerc_client_dispatch (client, &header,
client->data);
playerxdr_cleanup_message(client->data, header.addr.interf,
header.type, header.subtype);
if (result == NULL)
! return NULL;
! got_data = 1;
break;
}
--- 646,655 ----
void *result = playerc_client_dispatch (client, &header,
client->data);
playerxdr_cleanup_message(client->data, header.addr.interf,
header.type, header.subtype);
+ client->data_received = 1;
if (result == NULL)
! {
! PLAYERC_WARN ("Failed to dispatch data message");
! return NULL;
! }
break;
}
***************
*** 657,674 ****
return NULL;
}
- // See if there is any queued data.
- if (playerc_client_pop (client, &header, client->data) < 0)
- {
- // If there is no queued data, peek at the socket
- if(playerc_client_internal_peek(client,0) <= 0)
- return NULL;
- // There's data on the socket, so read a packet (blocking).
- if (playerc_client_readpacket (client, &header, client->data) < 0)
- return NULL;
- }
}
}
-
// Write a command
int playerc_client_write(playerc_client_t *client,
--- 664,670 ----
Index: playerc.h
===================================================================
RCS file: /cvsroot/playerstage/code/player/client_libs/libplayerc/playerc.h,v
retrieving revision 1.241
retrieving revision 1.242
diff -C2 -d -r1.241 -r1.242
*** playerc.h 27 Nov 2007 03:20:40 -0000 1.241
--- playerc.h 29 Nov 2007 03:37:23 -0000 1.242
***************
*** 469,472 ****
--- 469,477 ----
int data_requested;
+ /** @internal Data request flag; if mode == PLAYER_DATAMODE_PULL, have we
+ * received any data in this round? */
+ int data_received;
+
+
/** List of available (but not necessarily subscribed) devices.
This list is filled in by playerc_client_get_devlist(). */
***************
*** 656,660 ****
/** @brief Issue a request to the server and await a reply (blocking).
@internal
! The rep_data pointer is filled with a pointer to the response data recieved.
It is
the callers responisbility to free this memory with the approriate player
_free method.
--- 661,665 ----
/** @brief Issue a request to the server and await a reply (blocking).
@internal
! The rep_data pointer is filled with a pointer to the response data received.
It is
the callers responisbility to free this memory with the approriate player
_free method.
***************
*** 1140,1143 ****
--- 1145,1150 ----
int playerc_blackboard_set_entry(playerc_blackboard_t *device,
player_blackboard_entry_t* entry);
+ //player_blackboard_entry_t
playerc_blackboard_subscribe_to_key2(playerc_blackboard_t *device, const char*
key);
+
/** @} */
-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell. From the desktop to the data center, Linux is going
mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit