mirror of
https://github.com/apache/cordova-android.git
synced 2025-01-19 23:25:11 +08:00
Fixing leaking sockets
This commit is contained in:
parent
93ec092eaf
commit
1d2efa0d25
@ -56,6 +56,7 @@ public class CallbackServer implements Runnable {
|
||||
@SuppressWarnings("unused")
|
||||
private static final String LOG_TAG = "CallbackServer";
|
||||
|
||||
private ServerSocket waitSocket;
|
||||
/**
|
||||
* The list of JavaScript statements to be sent to JavaScript.
|
||||
*/
|
||||
@ -200,7 +201,7 @@ public class CallbackServer implements Runnable {
|
||||
try {
|
||||
this.active = true;
|
||||
String request;
|
||||
ServerSocket waitSocket = new ServerSocket(0);
|
||||
waitSocket = new ServerSocket(0);
|
||||
this.port = waitSocket.getLocalPort();
|
||||
//Log.d(LOG_TAG, "CallbackServer -- using port " +this.port);
|
||||
this.token = java.util.UUID.randomUUID().toString();
|
||||
@ -289,6 +290,8 @@ public class CallbackServer implements Runnable {
|
||||
if (this.active) {
|
||||
this.active = false;
|
||||
|
||||
try { waitSocket.close(); } catch (IOException ignore) {}
|
||||
|
||||
// Break out of server wait
|
||||
synchronized (this) {
|
||||
this.notify();
|
||||
|
Loading…
Reference in New Issue
Block a user