fixed to close socket while client and server stopping

This commit is contained in:
bvn13 2022-02-17 23:21:41 +03:00
parent 63689f61e8
commit 1dcf9dec7a
3 changed files with 11 additions and 1 deletions

View File

@ -5,7 +5,7 @@ plugins {
} }
group 'me.bvn13' group 'me.bvn13'
version '1.2.1' version '1.2.2'
repositories { repositories {
mavenCentral() mavenCentral()

View File

@ -90,6 +90,11 @@ public class Client<T extends AbstractClientListener> {
public void stop() { public void stop() {
log.debug("Stopping client"); log.debug("Stopping client");
client.stop(); client.stop();
try {
socket.close();
} catch (IOException e) {
log.error("Failed to close socket");
}
executor.shutdown(); executor.shutdown();
} }

View File

@ -98,6 +98,11 @@ public class Server<T extends AbstractClientListener> {
client.stop(); client.stop();
iterator.remove(); iterator.remove();
} }
try {
socket.close();
} catch (IOException e) {
log.error("Failed to close socket");
}
executor.shutdown(); executor.shutdown();
} }