aboutsummaryrefslogtreecommitdiffstats
path: root/android
diff options
context:
space:
mode:
authorJiang, Yunhong <yunhong.jiang@intel.com>2012-04-29 03:46:19 +0800
committerJiang, Yunhong <yunhong.jiang@intel.com>2012-06-01 03:27:08 +0800
commit33f5c65179d1d6608463aec013c30e18811913c8 (patch)
treecdc7f386e1fd91b8211cbe4331eba997d4ea9f9f /android
parent4912ddd4570cef75a9434b12eff707b3c834cc05 (diff)
downloadexternal_qemu-33f5c65179d1d6608463aec013c30e18811913c8.zip
external_qemu-33f5c65179d1d6608463aec013c30e18811913c8.tar.gz
external_qemu-33f5c65179d1d6608463aec013c30e18811913c8.tar.bz2
Mark gles pipe connected after callback invoked
Currently the net pipe is mark connected right after initialization through asyncConnector_run invokation. However, asyncConnector_run is intended only invoked when callback through select. In some extrem situation, this will cause the qemu pipe driver begin send buffer before the connection is setup. Change this to be asyncConnector_run usage correct, and sendBuffer will check the connection status. Change-Id: Ib10e72e56e1ed5017fc3654b0fce8cacf484c8f8 Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
Diffstat (limited to 'android')
-rw-r--r--android/hw-pipe-net.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/android/hw-pipe-net.c b/android/hw-pipe-net.c
index 5a25401..3e8dc70 100644
--- a/android/hw-pipe-net.c
+++ b/android/hw-pipe-net.c
@@ -204,10 +204,9 @@ netPipe_initFromAddress( void* hwpipe, const SockAddress* address, Looper* loop
}
loopIo_init(pipe->io, looper, fd, netPipe_io_func, pipe);
- asyncConnector_init(pipe->connector, address, pipe->io);
+ status = asyncConnector_init(pipe->connector, address, pipe->io);
pipe->state = STATE_CONNECTING;
- status = asyncConnector_run(pipe->connector);
if (status == ASYNC_ERROR) {
D("%s: Could not connect to socket: %s",
__FUNCTION__, errno_str);
@@ -234,6 +233,17 @@ netPipe_closeFromGuest( void* opaque )
netPipe_free(pipe);
}
+static int netPipeReadySend(NetPipe *pipe)
+{
+ if (pipe->state == STATE_CONNECTED)
+ return 0;
+ else if (pipe->state == STATE_CONNECTING)
+ return PIPE_ERROR_AGAIN;
+ else if (pipe->hwpipe == NULL)
+ return PIPE_ERROR_INVAL;
+ else
+ return PIPE_ERROR_IO;
+}
static int
netPipe_sendBuffers( void* opaque, const GoldfishPipeBuffer* buffers, int numBuffers )
@@ -245,6 +255,10 @@ netPipe_sendBuffers( void* opaque, const GoldfishPipeBuffer* buffers, int numBuf
const GoldfishPipeBuffer* buff = buffers;
const GoldfishPipeBuffer* buffEnd = buff + numBuffers;
+ ret = netPipeReadySend(pipe);
+ if (ret != 0)
+ return ret;
+
for (; buff < buffEnd; buff++)
count += buff->size;