Commit 8586e1ec authored by Dominik Charousset's avatar Dominik Charousset Committed by Dominik Charousset

Fix potential double-close on socket

(cherry picked from commit e0f3ff99)
parent e7b3d8cc
...@@ -233,12 +233,10 @@ public: ...@@ -233,12 +233,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