diff options
author | ritchie <ritchie@gmx.at> | 2015-09-13 06:22:54 +0200 |
---|---|---|
committer | ritchie <ritchie@gmx.at> | 2015-09-13 06:22:54 +0200 |
commit | ffabe5fa1bbf87cffbfbaaa3ed255fa23d273535 (patch) | |
tree | 58aa705a1bb56a8ca4a6c7d82fba65898ba8953e /websocket/src/main | |
parent | cebdea5194b468d09fa78f69c4b234c9a7acb080 (diff) | |
download | nanohttpd-ffabe5fa1bbf87cffbfbaaa3ed255fa23d273535.tar.gz |
file upload refactorings and set minimal coverage per module #219 #216
Diffstat (limited to 'websocket/src/main')
-rw-r--r-- | websocket/src/main/java/fi/iki/elonen/NanoWebSocketServer.java | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/websocket/src/main/java/fi/iki/elonen/NanoWebSocketServer.java b/websocket/src/main/java/fi/iki/elonen/NanoWebSocketServer.java index e23abe2..73e5f67 100644 --- a/websocket/src/main/java/fi/iki/elonen/NanoWebSocketServer.java +++ b/websocket/src/main/java/fi/iki/elonen/NanoWebSocketServer.java @@ -96,13 +96,13 @@ public abstract class NanoWebSocketServer extends NanoHTTPD { this.handshakeResponse.addHeader(NanoWebSocketServer.HEADER_CONNECTION, NanoWebSocketServer.HEADER_CONNECTION_VALUE); } - public void close(CloseCode code, String reason) throws IOException { + public void close(CloseCode code, String reason, boolean initiatedByRemote) throws IOException { State oldState = this.state; this.state = State.CLOSING; if (oldState == State.OPEN) { sendFrame(new CloseFrame(code, reason)); } else { - doClose(code, reason, false); + doClose(code, reason, initiatedByRemote); } } @@ -149,13 +149,7 @@ public abstract class NanoWebSocketServer extends NanoHTTPD { // Answer for my requested close doClose(code, reason, false); } else { - // Answer close request from other endpoint and close self - State oldState = this.state; - this.state = State.CLOSING; - if (oldState == State.OPEN) { - sendFrame(new CloseFrame(code, reason)); - } - doClose(code, reason, true); + close(code, reason, true); } } |