mirror of
https://github.com/TonyJiangWJ/Auto.js.git
synced 2026-06-21 21:01:43 +08:00
This commit is contained in:
parent
32e07c6951
commit
077612fa05
@ -35,7 +35,7 @@ public class SublimePluginClient {
|
||||
}
|
||||
}
|
||||
|
||||
private Socket mSocket;
|
||||
private volatile Socket mSocket;
|
||||
private Handler mResponseHandler;
|
||||
private String host;
|
||||
private int port;
|
||||
@ -73,6 +73,10 @@ public class SublimePluginClient {
|
||||
}).start();
|
||||
}
|
||||
|
||||
public boolean isListening() {
|
||||
return mSocket != null;
|
||||
}
|
||||
|
||||
private void tryClose() {
|
||||
try {
|
||||
close();
|
||||
|
||||
@ -13,7 +13,7 @@ public class SublimePluginService {
|
||||
private static SublimePluginClient client;
|
||||
|
||||
public static boolean isConnected() {
|
||||
return client != null;
|
||||
return client != null && client.isListening();
|
||||
}
|
||||
|
||||
public static void disconnectIfNeeded() {
|
||||
@ -44,6 +44,10 @@ public class SublimePluginService {
|
||||
JsonObject object = new JsonObject();
|
||||
object.addProperty("type", "log");
|
||||
object.addProperty("log", log);
|
||||
client.send(object);
|
||||
try {
|
||||
client.send(object);
|
||||
} catch (IllegalStateException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user