Send a one byte message in send_fd because otherwise it sometimes hangs on Linux. (#41)

This commit is contained in:
Robert Nishihara
2016-10-15 11:44:51 -07:00
committed by Philipp Moritz
parent 5ad8e145ae
commit f189ca746b
2 changed files with 6 additions and 3 deletions
+4 -2
View File
@@ -164,8 +164,10 @@ int plasma_subscribe(plasma_store_conn *conn) {
plasma_request req = {};
plasma_send_request(conn->conn, PLASMA_SUBSCRIBE, &req);
/* Send the file descriptor that the Plasma store should use to push
* notifications about sealed objects to this client. */
send_fd(conn->conn, fd[1], NULL, 0);
* notifications about sealed objects to this client. We include a one byte
* message because otherwise it seems to hang on Linux. */
char dummy = '\0';
send_fd(conn->conn, fd[1], &dummy, 1);
/* Return the file descriptor that the client should use to read notifications
* about sealed objects. */
return fd[0];
+2 -1
View File
@@ -282,7 +282,8 @@ void send_notifications(event_loop *loop,
/* Subscribe to notifications about sealed objects. */
void subscribe_to_updates(plasma_store_state *s, int conn) {
LOG_DEBUG("subscribing to updates");
int fd = recv_fd(conn, NULL, 0);
char dummy;
int fd = recv_fd(conn, &dummy, 1);
CHECKM(HASH_CNT(handle, s->open_objects) == 0,
"plasma_subscribe should be called before any objects are created.");
CHECKM(HASH_CNT(handle, s->sealed_objects) == 0,