mozilla/libadb.js — pull request #30 by jryans (2014-04-10 22:58:43+00:00)
Title: Bug 994980 - Improved restart when swapping back from console ADB. Fixes #8.

These changes smooth over handling when there's already a server running (from the terminal).

When trying to start libadb, we now check for an existing server and kill it if it exists. Note that, at least on Mac, I have seen this cause the old server to segfault, but at least it goes away... I haven't found a way to kill it more cleanly. Though, I also saw this happen when using the actual ADB binary, so maybe there's nothing to do about this issue.

This also cleans up some shutdown code paths, so we are better prepared to cycle between on / off states via the new "refresh" function I am adding.