diff options
author | Jesse Hall <jessehall@google.com> | 2012-07-09 16:15:24 -0700 |
---|---|---|
committer | Jesse Hall <jessehall@google.com> | 2012-07-09 16:18:35 -0700 |
commit | d7c0637f2afbaf681cf889855e8aed555a820c18 (patch) | |
tree | 1a3a58ee4bf184843a53d311eba24a83a104fc60 | |
parent | 0d8f973905a4925e00eb9e32887c192b2148b29f (diff) | |
download | sdk-d7c0637f2afbaf681cf889855e8aed555a820c18.zip sdk-d7c0637f2afbaf681cf889855e8aed555a820c18.tar.gz sdk-d7c0637f2afbaf681cf889855e8aed555a820c18.tar.bz2 |
Fix socket leak when shutting down renderer
This leak has always been there, but normally only leaks one socket
per emulator instance. Worse, though, is that the socket is listening
for connections on a hardcoded port, so it prevents other emulators
from listening on that port. Since we now start the GL renderer
briefly in every emulator instance (for GL string collection) this
means only one emulator can run at a time, even if none are using GL
acceleration.
Even with this fix, a GL-accelerated emulator will prevent any other
emulator (accelerated or not) from starting, since it is listening on
the hardcoded port, and the new emulator will try to listen on and
connect to that port at least for GL string collection. That will be
fixed in a future change.
Bug: 33383
Change-Id: I62a8a67eb6afb6c53cb41a19d00b6449cf5e1abe
-rw-r--r-- | emulator/opengl/host/libs/libOpenglRender/RenderServer.cpp | 9 | ||||
-rw-r--r-- | emulator/opengl/host/libs/libOpenglRender/RenderServer.h | 2 |
2 files changed, 10 insertions, 1 deletions
diff --git a/emulator/opengl/host/libs/libOpenglRender/RenderServer.cpp b/emulator/opengl/host/libs/libOpenglRender/RenderServer.cpp index 78f305c..938a96b 100644 --- a/emulator/opengl/host/libs/libOpenglRender/RenderServer.cpp +++ b/emulator/opengl/host/libs/libOpenglRender/RenderServer.cpp @@ -32,6 +32,12 @@ RenderServer::RenderServer() : { } +RenderServer::~RenderServer() +{ + delete m_listenSock; +} + + extern "C" int gRendererStreamMode; RenderServer *RenderServer::create(int port) @@ -78,7 +84,8 @@ int RenderServer::Main() continue; } - DBG("\n\n\n\n Got new stream!!!! \n\n\n\n\n"); + DBG("RenderServer: Got new stream!\n"); + // check if we have been requested to exit while waiting on accept if ((clientFlags & IOSTREAM_CLIENT_EXIT_SERVER) != 0) { m_exiting = true; diff --git a/emulator/opengl/host/libs/libOpenglRender/RenderServer.h b/emulator/opengl/host/libs/libOpenglRender/RenderServer.h index 98e9890..c1f0a08 100644 --- a/emulator/opengl/host/libs/libOpenglRender/RenderServer.h +++ b/emulator/opengl/host/libs/libOpenglRender/RenderServer.h @@ -23,6 +23,8 @@ class RenderServer : public osUtils::Thread { public: static RenderServer *create(int port); + virtual ~RenderServer(); + virtual int Main(); bool isExiting() const { return m_exiting; } |