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

libhv服务端我想发完本协议后直接关闭连接要怎样实现? #59

Closed
uniqss opened this issue May 11, 2021 · 2 comments
Closed

Comments

@uniqss
Copy link

uniqss commented May 11, 2021

tcp/http/websocket我想发完本次消息后立即关闭本连接,tcp/websocket我就是想发完本消息后就关闭掉,http我是想就做成one-shot的服务,不要有一堆的其他关闭中的状态,很耗。请问如何实现呢?libevent/libuv都有这个坑,发完直接调close会出问题,要改中间封装层或者源码才行。

@ithewei
Copy link
Owner

ithewei commented May 11, 2021

c版本hio_close(io)
c++版本Channel::close
WebSocketChannel::close
以上接口都是线程安全的,在其他线程调用,会post到io所在线程去执行
http头部设置Connection: Close的就是one-shot的,一次请求响应后内部就close掉了

@uniqss
Copy link
Author

uniqss commented May 11, 2021

非常感谢!我试试!这么好用的话果断换了

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