add Context::close()

This commit is contained in:
Michael Davidsaver
2022-11-27 08:20:13 -08:00
parent 722759416b
commit 0de17036f4
5 changed files with 43 additions and 1 deletions
+3
View File
@@ -46,6 +46,9 @@ Connection::~Connection()
std::shared_ptr<Connection> Connection::build(const std::shared_ptr<ContextImpl>& context,
const SockAddr& serv, bool reconn)
{
if(context->state!=ContextImpl::Running)
throw std::logic_error("Context close()d");
std::shared_ptr<Connection> ret;
auto it = context->connByAddr.find(serv);
if(it==context->connByAddr.end() || !(ret = it->second.lock())) {