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
2 files changed