Skip to content

Commit

Permalink
Fix a crash when GPU emulation doesn't work.
Browse files Browse the repository at this point in the history
This patch fixes a simple segmentation fault in the case
where we can't connect to the GPU emulation rendering library.

Change-Id: I47df0cae9029aee4738fd89083750e3baca5f032
  • Loading branch information
digit-android committed Aug 29, 2011
1 parent 81aafe2 commit 6a8b698
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions android/hw-pipe-net.c
Expand Up @@ -466,21 +466,23 @@ openglesPipe_init( void* hwpipe, void* _looper, const char* args )
snprintf(temp, sizeof temp, "%d", DEFAULT_OPENGLES_PORT);
pipe = (NetPipe *)netPipe_initTcp(hwpipe, _looper, temp);

// Disable TCP nagle algorithm to improve throughput of small packets
socket_set_nodelay(pipe->io->fd);
if (pipe != NULL) {
// Disable TCP nagle algorithm to improve throughput of small packets
socket_set_nodelay(pipe->io->fd);

// On Win32, adjust buffer sizes
#ifdef _WIN32
{
int sndbuf = 128 * 1024;
int len = sizeof(sndbuf);
if (setsockopt(pipe->io->fd, SOL_SOCKET, SO_SNDBUF,
(char*)&sndbuf, len) == SOCKET_ERROR) {
D("Failed to set SO_SNDBUF to %d error=0x%x\n",
sndbuf, WSAGetLastError());
{
int sndbuf = 128 * 1024;
int len = sizeof(sndbuf);
if (setsockopt(pipe->io->fd, SOL_SOCKET, SO_SNDBUF,
(char*)&sndbuf, len) == SOCKET_ERROR) {
D("Failed to set SO_SNDBUF to %d error=0x%x\n",
sndbuf, WSAGetLastError());
}
}
}
#endif /* _WIN32 */
}

return pipe;
}
Expand Down

0 comments on commit 6a8b698

Please sign in to comment.