- 论坛徽章:
- 3
|
本帖最后由 joepayne 于 2017-11-15 20:52 编辑
回复 7# Fixend
对,系统底层的东西基本没多少变化,只是C++标准换血了,特性也多元化了
这个地方我也想到了,是server-side主动关闭的,但是,这里我只是把service线程的资源给释放掉了,其中的socket只是一个shared_ptr,其连接这里并没有释放掉。
- private:
- std::shared_ptr<asio::ip::tcp::socket> m_sock;
- std::string m_response;
- asio::streambuf m_request;
复制代码
socket只是在
- void InitAccept() {
- std::shared_ptr<asio::ip::tcp::socket> sock = std::make_shared<asio::ip::tcp::socket>(m_ios);
- m_acceptor.async_accept(*sock.get(),
- [this, sock](const boost::system::error_code& error) {
- onAccept(error, sock);
- }
- );
- }
复制代码 这个函数执行完才断开的,是吧?那这里我应该再维护一个socket池子?
|
|