Revision: 7248
http://playerstage.svn.sourceforge.net/playerstage/?rev=7248&view=rev
Author: thjc
Date: 2009-01-06 19:31:27 +0000 (Tue, 06 Jan 2009)
Log Message:
-----------
Applied version of patch 2145007: fix up incorrect return type from
playerc_client_read when sock < 0. Also removes small delay from read loop when
not data is waiting (using a poll instead).
Modified Paths:
--------------
code/player/branches/release-2-1-patches/client_libs/libplayerc/client.c
Modified:
code/player/branches/release-2-1-patches/client_libs/libplayerc/client.c
===================================================================
--- code/player/branches/release-2-1-patches/client_libs/libplayerc/client.c
2009-01-06 18:51:07 UTC (rev 7247)
+++ code/player/branches/release-2-1-patches/client_libs/libplayerc/client.c
2009-01-06 19:31:27 UTC (rev 7248)
@@ -88,7 +88,7 @@
char *data);
int playerc_client_writepacket(playerc_client_t *client,
player_msghdr_t *header,
- char *data);
+ const char *data);
void playerc_client_push(playerc_client_t *client,
player_msghdr_t *header, void *data);
int playerc_client_pop(playerc_client_t *client,
@@ -620,23 +620,24 @@
// Read and process a packet (blocking)
void *playerc_client_read(playerc_client_t *client)
{
- void* ret_proxy;
+ void* ret_proxy = NULL;
int ret;
- // 10ms delay
- struct timespec sleeptime = {0,10000000};
- for(;;)
+ // In case we're in PULL mode, first request a round of data.
+ if(playerc_client_requestdata(client) < 0)
+ return NULL;
+ // now wait until we get a sync, or some data if in push mode
+ do
{
- // In case we're in PULL mode, first request a round of data.
- if(playerc_client_requestdata(client) < 0)
- return NULL;
ret = playerc_client_read_nonblock_withproxy(client, &ret_proxy);
- if((ret > 0) || (client->sock < 0))
+ if (ret < 0 || client->sock < 0)
+ break;
+ if(ret > 0)
return ret_proxy;
- if (ret < 0)
- return NULL;
- nanosleep(&sleeptime,NULL);
- }
+ // if no data is available, then do a peek with infinite timeout...
+ // we cant do this first as we may already have data waiting on the
internal queue
+ } while (playerc_client_internal_peek(client, -1) >= 0);
+ return NULL;
}
@@ -1180,7 +1181,7 @@
// Write a raw packet
int playerc_client_writepacket(playerc_client_t *client,
- player_msghdr_t *header, char *data)
+ player_msghdr_t *header, const char *data)
{
int bytes, ret, length;
player_pack_fn_t packfunc;
@@ -1310,8 +1311,7 @@
{
int i, j;
playerc_device_t *device;
- void * ret;
- ret = NULL;
+ void *ret = NULL;
// Look for a device proxy to handle this data
for (i = 0; i < client->device_count; i++)
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It is the best place to buy or sell services for
just about anything Open Source.
http://p.sf.net/sfu/Xq1LFB
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit