Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbff695e

Browse files
committed
Drop WebSocketUpgradeHandler:: touchSuccess
MotivationThis hack was a very old workaround forAsyncHttpClient#317 where the server wouldsend the first frame along with the handshake.This issue has actually been fixed for quite some time, we just had toreplace the `UpgradeCallback` with the future before triggering theread when upgrading the pipeline.We no longer need this protection as there’s no way the`UpgradeCallback` can be called twice.Modification:Remove dead code.Result:Clean code
1 parent7a70b80 commitbff695e

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

‎client/src/main/java/org/asynchttpclient/netty/handler/WebSocketHandler.java‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,10 @@ public UpgradeCallback(NettyResponseFuture<?> future, Channel channel, HttpRespo
7373
// We don't need to synchronize as replacing the "ws-decoder" will
7474
// process using the same thread.
7575
privatevoidinvokeOnSucces(Channelchannel,WebSocketUpgradeHandlerh) {
76-
if (!h.touchSuccess()) {
77-
try {
78-
h.onSuccess(newNettyWebSocket(channel,responseHeaders.getHeaders()));
79-
}catch (Exceptionex) {
80-
logger.warn("onSuccess unexpected exception",ex);
81-
}
76+
try {
77+
h.onSuccess(newNettyWebSocket(channel,responseHeaders.getHeaders()));
78+
}catch (Exceptionex) {
79+
logger.warn("onSuccess unexpected exception",ex);
8280
}
8381
}
8482

‎client/src/main/java/org/asynchttpclient/ws/WebSocketUpgradeHandler.java‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ public class WebSocketUpgradeHandler implements UpgradeHandler<WebSocket>, Async
3333
privateWebSocketwebSocket;
3434
privatefinalList<WebSocketListener>listeners;
3535
privatefinalAtomicBooleanok =newAtomicBoolean(false);
36-
privatebooleanonSuccessCalled;
3736
privateintstatus;
3837
privateList<Runnable>bufferedFrames;
3938

@@ -53,11 +52,6 @@ public final void onThrowable(Throwable t) {
5352
onFailure(t);
5453
}
5554

56-
publicbooleantouchSuccess() {
57-
booleanprev =onSuccessCalled;
58-
onSuccessCalled =true;
59-
returnprev;
60-
}
6155

6256
@Override
6357
publicfinalStateonBodyPartReceived(HttpResponseBodyPartbodyPart)throwsException {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp