diff --git a/NEWS b/NEWS index c7f35f4b47bc364e6e619b4bef20fe61565471b9..844088922c59ffd7d43073a21405f70a57ae99a8 100644 --- a/NEWS +++ b/NEWS @@ -18,6 +18,8 @@ documents those changes that are of interest to users and admins. -- job_desc_msg_t - in, out, err have been changed to std_in, std_out, and std_err respectfully. Needed for PySLURM, since Python sees (in) as a keyword. + -- Changed the type of addr to struct sockaddr_in in _message_socket_accept() + in sattach.c, step_launch.c, and allocate_msg.c * Changes in SLURM 2.1.0-pre7 ============================= diff --git a/src/api/allocate_msg.c b/src/api/allocate_msg.c index 18985bfe35c6d3347daff2b7e48d76b264e175bb..74df9a43b4b4068171b8cc80fbc66c449e67a896 100644 --- a/src/api/allocate_msg.c +++ b/src/api/allocate_msg.c @@ -182,9 +182,8 @@ static bool _message_socket_readable(eio_obj_t *obj) debug2(" false"); } return false; - } else { - return true; } + return true; } static int _message_socket_accept(eio_obj_t *obj, List objs) @@ -194,21 +193,20 @@ static int _message_socket_accept(eio_obj_t *obj, List objs) int fd; unsigned char *uc; - short port; - struct sockaddr_un addr; + unsigned short port; + struct sockaddr_in addr; slurm_msg_t *msg = NULL; int len = sizeof(addr); - - debug2("Called _msg_socket_accept"); + + debug3("Called _msg_socket_accept"); while ((fd = accept(obj->fd, (struct sockaddr *)&addr, (socklen_t *)&len)) < 0) { if (errno == EINTR) continue; - - if (errno == EAGAIN - || errno == ECONNABORTED - || errno == EWOULDBLOCK) { + if (errno == EAGAIN || + errno == ECONNABORTED || + errno == EWOULDBLOCK) { return SLURM_SUCCESS; } error("Error on msg accept socket: %m"); @@ -221,8 +219,8 @@ static int _message_socket_accept(eio_obj_t *obj, List objs) /* Should not call slurm_get_addr() because the IP may not be in /etc/hosts. */ - uc = (unsigned char *)&((struct sockaddr_in *)&addr)->sin_addr.s_addr; - port = ((struct sockaddr_in *)&addr)->sin_port; + uc = (unsigned char *)&addr.sin_addr.s_addr; + port = addr.sin_port; debug2("allocation got message connection from %u.%u.%u.%u:%hu", uc[0], uc[1], uc[2], uc[3], ntohs(port)); fflush(stdout); @@ -231,8 +229,6 @@ static int _message_socket_accept(eio_obj_t *obj, List objs) slurm_msg_t_init(msg); again: if(slurm_receive_msg(fd, msg, 0) != 0) { - printf("error on slurm_recieve_msg\n"); - fflush(stdout); if (errno == EINTR) { goto again; } @@ -240,7 +236,7 @@ again: uc[0],uc[1],uc[2],uc[3]); goto cleanup; } - + _handle_msg(msg_thr, msg); /* handle_msg frees msg->data */ cleanup: if ((msg->conn_fd >= 0) && slurm_close_accepted_conn(msg->conn_fd) < 0) diff --git a/src/api/step_launch.c b/src/api/step_launch.c index b269d42d8521a139df295194f9633384c39cf559..9c31101f64585a67310478d127a332e2f3aa08e1 100644 --- a/src/api/step_launch.c +++ b/src/api/step_launch.c @@ -824,22 +824,21 @@ static int _message_socket_accept(eio_obj_t *obj, List objs) int fd; unsigned char *uc; - short port; - struct sockaddr_un addr; + unsigned short port; + struct sockaddr_in addr; slurm_msg_t *msg = NULL; int len = sizeof(addr); int timeout = 0; /* slurm default value */ - int rc = 0; - + debug3("Called _msg_socket_accept"); while ((fd = accept(obj->fd, (struct sockaddr *)&addr, (socklen_t *)&len)) < 0) { if (errno == EINTR) continue; - if (errno == EAGAIN - || errno == ECONNABORTED - || errno == EWOULDBLOCK) { + if (errno == EAGAIN || + errno == ECONNABORTED || + errno == EWOULDBLOCK) { return SLURM_SUCCESS; } error("Error on msg accept socket: %m"); @@ -852,8 +851,8 @@ static int _message_socket_accept(eio_obj_t *obj, List objs) /* Should not call slurm_get_addr() because the IP may not be in /etc/hosts. */ - uc = (unsigned char *)&((struct sockaddr_in *)&addr)->sin_addr.s_addr; - port = ((struct sockaddr_in *)&addr)->sin_port; + uc = (unsigned char *)&addr.sin_addr.s_addr; + port = addr.sin_port; debug2("step got message connection from %u.%u.%u.%u:%hu", uc[0], uc[1], uc[2], uc[3], ntohs(port)); fflush(stdout); @@ -866,7 +865,7 @@ static int _message_socket_accept(eio_obj_t *obj, List objs) * responses and timeouts. Raise the default timeout for srun. */ timeout = slurm_get_msg_timeout() * 8000; again: - if((rc = slurm_receive_msg(fd, msg, timeout)) != 0) { + if(slurm_receive_msg(fd, msg, timeout) != 0) { if (errno == EINTR) { goto again; } @@ -875,7 +874,7 @@ again: goto cleanup; } - _handle_msg(sls, msg); /* handle_msg frees msg */ + _handle_msg(sls, msg); /* handle_msg frees msg->data */ cleanup: if ((msg->conn_fd >= 0) && slurm_close_accepted_conn(msg->conn_fd) < 0) error ("close(%d): %m", msg->conn_fd); diff --git a/src/sattach/sattach.c b/src/sattach/sattach.c index 92e1fb7da74be0a9af34a30b2bfba99a2a491063..17352e0da9aaee4f33631e2e659ed996f146e9a3 100644 --- a/src/sattach/sattach.c +++ b/src/sattach/sattach.c @@ -486,11 +486,10 @@ static int _message_socket_accept(eio_obj_t *obj, List objs) int fd; unsigned char *uc; - short port; - struct sockaddr_un addr; + unsigned short port; + struct sockaddr_in addr; slurm_msg_t *msg = NULL; int len = sizeof(addr); - int timeout = 0; /* slurm default value */ debug3("Called _msg_socket_accept"); @@ -498,9 +497,9 @@ static int _message_socket_accept(eio_obj_t *obj, List objs) (socklen_t *)&len)) < 0) { if (errno == EINTR) continue; - if ((errno == EAGAIN) || - (errno == ECONNABORTED) || - (errno == EWOULDBLOCK)) { + if (errno == EAGAIN || + errno == ECONNABORTED || + errno == EWOULDBLOCK) { return SLURM_SUCCESS; } error("Error on msg accept socket: %m"); @@ -513,18 +512,16 @@ static int _message_socket_accept(eio_obj_t *obj, List objs) /* Should not call slurm_get_addr() because the IP may not be in /etc/hosts. */ - uc = (unsigned char *)&((struct sockaddr_in *)&addr)->sin_addr.s_addr; - port = ((struct sockaddr_in *)&addr)->sin_port; + uc = (unsigned char *)&addr.sin_addr.s_addr; + port = addr.sin_port; debug2("got message connection from %u.%u.%u.%u:%hu", uc[0], uc[1], uc[2], uc[3], ntohs(port)); fflush(stdout); msg = xmalloc(sizeof(slurm_msg_t)); slurm_msg_t_init(msg); - - timeout = slurm_get_msg_timeout() * 1000; again: - if(slurm_receive_msg(fd, msg, timeout) != 0) { + if(slurm_receive_msg(fd, msg, 0) != 0) { if (errno == EINTR) { goto again; }