Skip to content

Commit 28cfffa

Browse files
committed
bind manager sockets before connecting to the store
1 parent dec6766 commit 28cfffa

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/plasma/plasma_manager.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -903,17 +903,21 @@ void start_server(const char *store_socket_name,
903903
int port,
904904
const char *db_addr,
905905
int db_port) {
906-
g_manager_state = init_plasma_manager_state(store_socket_name, master_addr,
907-
port, db_addr, db_port);
908-
CHECK(g_manager_state);
909-
906+
/* Bind the sockets before we try to connect to the plasma store.
907+
* In case the bind does not succeed, we want to be able to exit
908+
* without breaking the pipe to the store. */
910909
int remote_sock = bind_inet_sock(port);
911910
if (remote_sock < 0) {
912911
exit(EXIT_COULD_NOT_BIND_PORT);
913912
}
913+
914914
int local_sock = bind_ipc_sock(manager_socket_name);
915915
CHECKM(local_sock >= 0, "Unable to bind local manager socket");
916916

917+
g_manager_state = init_plasma_manager_state(store_socket_name, master_addr,
918+
port, db_addr, db_port);
919+
CHECK(g_manager_state);
920+
917921
LOG_DEBUG("Started server connected to store %s, listening on port %d",
918922
store_socket_name, port);
919923
event_loop_add_file(g_manager_state->loop, local_sock, EVENT_LOOP_READ,

0 commit comments

Comments
 (0)