Skip to content

Commit a5f3a8d

Browse files
committed
feat(sdk): make client closeable
1 parent a605366 commit a5f3a8d

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

sdk/src/server-api/sc/networking/clients/IClient.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
import sc.protocol.ProtocolPacket;
44

5+
import java.io.Closeable;
6+
57
/** Client interface to send packages to the server. */
6-
public interface IClient {
8+
public interface IClient extends Closeable {
79
/** Send a package. */
810
void send(ProtocolPacket packet);
911
}

sdk/src/server-api/sc/networking/clients/XStreamClient.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,9 @@ protected synchronized void stopReceiver() {
249249
this.receiveThread.interrupt();
250250
}
251251

252-
protected synchronized void close() {
252+
/** Closes the client without notifying any listeners.
253+
* Prefer {@link #stop()} to end communication properly. */
254+
public synchronized void close() {
253255
if (!isClosed()) {
254256
this.closed = true;
255257

0 commit comments

Comments
 (0)