This commit is contained in:
@@ -35,7 +35,7 @@ public class SublimePluginClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Socket mSocket;
|
private volatile Socket mSocket;
|
||||||
private Handler mResponseHandler;
|
private Handler mResponseHandler;
|
||||||
private String host;
|
private String host;
|
||||||
private int port;
|
private int port;
|
||||||
@@ -73,6 +73,10 @@ public class SublimePluginClient {
|
|||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isListening() {
|
||||||
|
return mSocket != null;
|
||||||
|
}
|
||||||
|
|
||||||
private void tryClose() {
|
private void tryClose() {
|
||||||
try {
|
try {
|
||||||
close();
|
close();
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ public class SublimePluginService {
|
|||||||
private static SublimePluginClient client;
|
private static SublimePluginClient client;
|
||||||
|
|
||||||
public static boolean isConnected() {
|
public static boolean isConnected() {
|
||||||
return client != null;
|
return client != null && client.isListening();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void disconnectIfNeeded() {
|
public static void disconnectIfNeeded() {
|
||||||
@@ -44,6 +44,10 @@ public class SublimePluginService {
|
|||||||
JsonObject object = new JsonObject();
|
JsonObject object = new JsonObject();
|
||||||
object.addProperty("type", "log");
|
object.addProperty("type", "log");
|
||||||
object.addProperty("log", log);
|
object.addProperty("log", log);
|
||||||
client.send(object);
|
try {
|
||||||
|
client.send(object);
|
||||||
|
} catch (IllegalStateException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user