osd: abort on startup if we fail to bind to a port

Signed-off-by: Sage Weil <sage@newdream.net>
This commit is contained in:
Sage Weil 2012-01-16 11:54:26 -08:00
parent 47db4d044c
commit 4f70acfac9

View File

@ -275,14 +275,20 @@ int main(int argc, const char **argv)
SimpleMessenger *messenger_hbin = new SimpleMessenger(g_ceph_context);
SimpleMessenger *messenger_hbout = new SimpleMessenger(g_ceph_context);
client_messenger->bind(g_conf->public_addr, getpid());
r = client_messenger->bind(g_conf->public_addr, getpid());
if (r < 0)
exit(1);
cluster_messenger->bind(g_conf->cluster_addr, getpid());
if (r < 0)
exit(1);
// hb should bind to same ip as cluster_addr (if specified)
entity_addr_t hb_addr = g_conf->cluster_addr;
if (!hb_addr.is_blank_ip())
hb_addr.set_port(0);
messenger_hbout->bind(hb_addr, getpid());
if (r < 0)
exit(1);
global_print_banner();