Commit e0f3ff99 authored by Dominik Charousset's avatar Dominik Charousset

Fix potential double-close on socket

parent f0301e51
...@@ -226,12 +226,10 @@ public: ...@@ -226,12 +226,10 @@ public:
return false; return false;
} }
auto scrb = make_counted<scribe_impl>(dm, fd, std::move(sssn)); auto scrb = make_counted<scribe_impl>(dm, fd, std::move(sssn));
sguard.release(); // The scribe claims ownership of the socket.
auto hdl = scrb->hdl(); auto hdl = scrb->hdl();
parent()->add_scribe(std::move(scrb)); parent()->add_scribe(std::move(scrb));
auto result = doorman::new_connection(&dm, hdl); return doorman::new_connection(&dm, hdl);
if (result)
sguard.release();
return result;
} }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment