separate the bind & listen calls on the http backplane

This commit is contained in:
Grant Limberg 2023-05-02 16:31:00 -07:00
commit c6ae8db308
No known key found for this signature in database
GPG key ID: 8F2F97D3BE8D7735

View file

@ -1994,14 +1994,21 @@ public:
fprintf(stderr, "%s", http_log(req, res).c_str());
});
#endif
_serverThread = std::thread([&] {
if (_primaryPort==0) {
fprintf(stderr, "unable to determine local control port");
exit(-1);
}
if(!_controlPlane.bind_to_port("0.0.0.0", _primaryPort)) {
fprintf(stderr, "Error binding control plane to port %d\n", _primaryPort);
exit(-1);
}
_serverThread = std::thread([&] {
fprintf(stderr, "Starting Control Plane...\n");
_controlPlane.listen("0.0.0.0", _primaryPort);
if(!_controlPlane.listen_after_bind()) {
fprintf(stderr, "Error on listen_after_bind()\n");
}
fprintf(stderr, "Control Plane Stopped\n");
});