X-Git-Url: https://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Futils%2Fserial%2Fserver%2FConnectActionServer.java;h=10d3440e7af4a4a09e5b7cdf06151ab15ac98f66;hb=a72ea8a7a30837734f7f3f27a4ec7979d2549043;hp=60f8db85db4f6f278a9b1f50ef1d41de92b0540e;hpb=04744179c3fc6a098dbe23495a5da1062d0651c1;p=nikiroo-utils.git diff --git a/src/be/nikiroo/utils/serial/server/ConnectActionServer.java b/src/be/nikiroo/utils/serial/server/ConnectActionServer.java index 60f8db8..10d3440 100644 --- a/src/be/nikiroo/utils/serial/server/ConnectActionServer.java +++ b/src/be/nikiroo/utils/serial/server/ConnectActionServer.java @@ -13,6 +13,8 @@ import be.nikiroo.utils.Version; * @author niki */ abstract class ConnectActionServer { + private boolean closing; + /** * The underlying {@link ConnectAction}. *

@@ -77,6 +79,32 @@ abstract class ConnectActionServer { }).start(); } + /** + * Stop the client/server connection on behalf of the server (usually, the + * client connects then is allowed to send as many requests as it wants; in + * some cases, though, the server may wish to forcefully close the + * connection and can do via this value, when it is set to TRUE). + *

+ * Example of usage: the client failed an authentication check, cut the + * connection here and now. + */ + public boolean isClosing() { + return closing; + } + + /** + * Can be called to stop the client/server connection on behalf of the + * server (usually, the client connects then is allowed to send as many + * requests as it wants; in some cases, though, the server may wish to + * forcefully close the connection and can do so by calling this method). + *

+ * Example of usage: the client failed an authentication check, cut the + * connection here and now. + */ + public void close() { + closing = true; + } + /** * The total amount of bytes received. *