Skip to content

Commit

Permalink
bind manager sockets before connecting to the store
Browse files Browse the repository at this point in the history
  • Loading branch information
pcmoritz committed Nov 1, 2016
1 parent dec6766 commit 28cfffa
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/plasma/plasma_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -903,17 +903,21 @@ void start_server(const char *store_socket_name,
int port,
const char *db_addr,
int db_port) {
g_manager_state = init_plasma_manager_state(store_socket_name, master_addr,
port, db_addr, db_port);
CHECK(g_manager_state);

/* Bind the sockets before we try to connect to the plasma store.
* In case the bind does not succeed, we want to be able to exit
* without breaking the pipe to the store. */
int remote_sock = bind_inet_sock(port);
if (remote_sock < 0) {
exit(EXIT_COULD_NOT_BIND_PORT);
}

int local_sock = bind_ipc_sock(manager_socket_name);
CHECKM(local_sock >= 0, "Unable to bind local manager socket");

g_manager_state = init_plasma_manager_state(store_socket_name, master_addr,
port, db_addr, db_port);
CHECK(g_manager_state);

LOG_DEBUG("Started server connected to store %s, listening on port %d",
store_socket_name, port);
event_loop_add_file(g_manager_state->loop, local_sock, EVENT_LOOP_READ,
Expand Down

0 comments on commit 28cfffa

Please sign in to comment.