Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BeforeHandshake关闭session后,nginx转发http响应的502 #243

Open
duanlizhi opened this issue Nov 30, 2022 · 2 comments
Open

BeforeHandshake关闭session后,nginx转发http响应的502 #243

duanlizhi opened this issue Nov 30, 2022 · 2 comments

Comments

@duanlizhi
Copy link

这个502的状态码是jar报里边封装的嘛?怎么调整其他的http响应码

@duanlizhi
Copy link
Author

根源是close方法的时候会报错,进入到OnError(),为什么呀

@liushuaikobe
Copy link

你 BeforeHandshake 里面关闭 session 应该是个异步操作吧,如果没有立刻关闭,框架还是会继续往下走,去尝试 handshake 的。参考:

pojoEndpointServer.doBeforeHandshake(channel, req, pattern);
// 虽然你调用了 session.close(),但是还没真正 close,下面的判断可能不会命中
if (!channel.isActive()) {
    return;
}

源码链接:https://github.com/YeautyYE/netty-websocket-spring-boot-starter/blob/master/src/main/java/org/yeauty/standard/HttpServerHandler.java#L212

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants