src/java.net.http/share/classes/jdk/internal/net/http/websocket/WebSocketImpl.java
equal
deleted
inserted
replaced
209 String reason) { |
209 String reason) { |
210 Objects.requireNonNull(reason); |
210 Objects.requireNonNull(reason); |
211 if (!isLegalToSendFromClient(statusCode)) { |
211 if (!isLegalToSendFromClient(statusCode)) { |
212 return failedFuture(new IllegalArgumentException("statusCode")); |
212 return failedFuture(new IllegalArgumentException("statusCode")); |
213 } |
213 } |
|
214 // check outputClosed |
214 CompletableFuture<WebSocket> cf = sendClose0(statusCode, reason); |
215 CompletableFuture<WebSocket> cf = sendClose0(statusCode, reason); |
215 return replaceNull(cf); |
216 return replaceNull(cf); |
216 } |
217 } |
217 |
218 |
218 /* |
219 /* |
430 ByteBuffer copy = ByteBuffer.allocate(binaryData.remaining()) |
431 ByteBuffer copy = ByteBuffer.allocate(binaryData.remaining()) |
431 .put(binaryData) |
432 .put(binaryData) |
432 .flip(); |
433 .flip(); |
433 // Non-exclusive send; |
434 // Non-exclusive send; |
434 BiConsumer<WebSocketImpl, Throwable> reporter = (r, e) -> { |
435 BiConsumer<WebSocketImpl, Throwable> reporter = (r, e) -> { |
435 if (e != null) { |
436 if (e != null) { // Better error handing. What if already closed? |
436 signalError(Utils.getCompletionCause(e)); |
437 signalError(Utils.getCompletionCause(e)); |
437 } |
438 } |
438 }; |
439 }; |
439 transport.sendPong(copy, WebSocketImpl.this, reporter); |
440 transport.sendPong(copy, WebSocketImpl.this, reporter); |
440 listener.onPing(WebSocketImpl.this, slice); |
441 listener.onPing(WebSocketImpl.this, slice); |