aboutsummaryrefslogtreecommitdiffstats
path: root/emulator/opengl/shared/OpenglCodecCommon/UnixStream.cpp
diff options
context:
space:
mode:
authorJesse Hall <jessehall@google.com>2012-07-11 16:25:37 -0700
committerJesse Hall <jessehall@google.com>2012-07-11 16:45:58 -0700
commitdca7f2a6ac56567850e0e03a063e1739e43c5ce2 (patch)
treedb0b5bd48d23a9bd1e03c23f1995802222516775 /emulator/opengl/shared/OpenglCodecCommon/UnixStream.cpp
parent310777dae93bc4e402ec8a807ce3151271d1038b (diff)
downloadsdk-dca7f2a6ac56567850e0e03a063e1739e43c5ce2.tar.gz
sdk-dca7f2a6ac56567850e0e03a063e1739e43c5ce2.tar.bz2
sdk-dca7f2a6ac56567850e0e03a063e1739e43c5ce2.zip
Use a per-process server address for the GLES server
Previously we used a hardcoded address (tcp port, unix pipe path, etc.) for the OpenGLRender system. Multiple emulators would all try to listen on the same address, with the system non-deterministically (?) choosing which one accepted each new connection. This resulted in frames going to the wrong emulator window, one emulator shutting down another's OpenGL system, etc. Now the OpenGLRender server requests an unused tcp port or derives a path from the pid, and reports the address back to the emulator client to use for future connections from the guest. Change-Id: I6af2eac0c7f27670a3b6595772eebc7aa2b24688
Diffstat (limited to 'emulator/opengl/shared/OpenglCodecCommon/UnixStream.cpp')
-rw-r--r--emulator/opengl/shared/OpenglCodecCommon/UnixStream.cpp17
1 files changed, 5 insertions, 12 deletions
diff --git a/emulator/opengl/shared/OpenglCodecCommon/UnixStream.cpp b/emulator/opengl/shared/OpenglCodecCommon/UnixStream.cpp
index 8e463a370..b2eef6dfa 100644
--- a/emulator/opengl/shared/OpenglCodecCommon/UnixStream.cpp
+++ b/emulator/opengl/shared/OpenglCodecCommon/UnixStream.cpp
@@ -86,15 +86,13 @@ make_unix_path(char *path, size_t pathlen, int port_number)
}
-int UnixStream::listen(unsigned short port)
+int UnixStream::listen(char addrstr[MAX_ADDRSTR_LEN])
{
- char path[PATH_MAX];
-
- if (make_unix_path(path, sizeof(path), port) < 0) {
+ if (make_unix_path(addrstr, MAX_ADDRSTR_LEN, getpid()) < 0) {
return -1;
}
- m_sock = socket_local_server(path, ANDROID_SOCKET_NAMESPACE_FILESYSTEM, SOCK_STREAM);
+ m_sock = socket_local_server(addrstr, ANDROID_SOCKET_NAMESPACE_FILESYSTEM, SOCK_STREAM);
if (!valid()) return int(ERR_INVALID_SOCKET);
return 0;
@@ -123,14 +121,9 @@ SocketStream * UnixStream::accept()
return clientStream;
}
-int UnixStream::connect(unsigned short port)
+int UnixStream::connect(const char* addr)
{
- char path[PATH_MAX];
-
- if (make_unix_path(path, sizeof(path), port) < 0)
- return -1;
-
- m_sock = socket_local_client(path, ANDROID_SOCKET_NAMESPACE_FILESYSTEM, SOCK_STREAM);
+ m_sock = socket_local_client(addr, ANDROID_SOCKET_NAMESPACE_FILESYSTEM, SOCK_STREAM);
if (!valid()) return -1;
return 0;