Skip to content
Snippets Groups Projects
Commit 9d632de9 authored by Don Lipari's avatar Don Lipari
Browse files

-- Changed the type of addr to struct sockaddr_in in _message_socket_accept()

   in sattach.c, step_launch.c, and allocate_msg.c
parent e7a80d42
No related branches found
No related tags found
No related merge requests found
...@@ -18,6 +18,8 @@ documents those changes that are of interest to users and admins. ...@@ -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, -- 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) and std_err respectfully. Needed for PySLURM, since Python sees (in)
as a keyword. 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 * Changes in SLURM 2.1.0-pre7
============================= =============================
......
...@@ -182,9 +182,8 @@ static bool _message_socket_readable(eio_obj_t *obj) ...@@ -182,9 +182,8 @@ static bool _message_socket_readable(eio_obj_t *obj)
debug2(" false"); debug2(" false");
} }
return false; return false;
} else {
return true;
} }
return true;
} }
static int _message_socket_accept(eio_obj_t *obj, List objs) 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) ...@@ -194,21 +193,20 @@ static int _message_socket_accept(eio_obj_t *obj, List objs)
int fd; int fd;
unsigned char *uc; unsigned char *uc;
short port; unsigned short port;
struct sockaddr_un addr; struct sockaddr_in addr;
slurm_msg_t *msg = NULL; slurm_msg_t *msg = NULL;
int len = sizeof(addr); int len = sizeof(addr);
debug2("Called _msg_socket_accept"); debug3("Called _msg_socket_accept");
while ((fd = accept(obj->fd, (struct sockaddr *)&addr, while ((fd = accept(obj->fd, (struct sockaddr *)&addr,
(socklen_t *)&len)) < 0) { (socklen_t *)&len)) < 0) {
if (errno == EINTR) if (errno == EINTR)
continue; continue;
if (errno == EAGAIN ||
if (errno == EAGAIN errno == ECONNABORTED ||
|| errno == ECONNABORTED errno == EWOULDBLOCK) {
|| errno == EWOULDBLOCK) {
return SLURM_SUCCESS; return SLURM_SUCCESS;
} }
error("Error on msg accept socket: %m"); error("Error on msg accept socket: %m");
...@@ -221,8 +219,8 @@ static int _message_socket_accept(eio_obj_t *obj, List objs) ...@@ -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 /* Should not call slurm_get_addr() because the IP may not be
in /etc/hosts. */ in /etc/hosts. */
uc = (unsigned char *)&((struct sockaddr_in *)&addr)->sin_addr.s_addr; uc = (unsigned char *)&addr.sin_addr.s_addr;
port = ((struct sockaddr_in *)&addr)->sin_port; port = addr.sin_port;
debug2("allocation got message connection from %u.%u.%u.%u:%hu", debug2("allocation got message connection from %u.%u.%u.%u:%hu",
uc[0], uc[1], uc[2], uc[3], ntohs(port)); uc[0], uc[1], uc[2], uc[3], ntohs(port));
fflush(stdout); fflush(stdout);
...@@ -231,8 +229,6 @@ static int _message_socket_accept(eio_obj_t *obj, List objs) ...@@ -231,8 +229,6 @@ static int _message_socket_accept(eio_obj_t *obj, List objs)
slurm_msg_t_init(msg); slurm_msg_t_init(msg);
again: again:
if(slurm_receive_msg(fd, msg, 0) != 0) { if(slurm_receive_msg(fd, msg, 0) != 0) {
printf("error on slurm_recieve_msg\n");
fflush(stdout);
if (errno == EINTR) { if (errno == EINTR) {
goto again; goto again;
} }
...@@ -240,7 +236,7 @@ again: ...@@ -240,7 +236,7 @@ again:
uc[0],uc[1],uc[2],uc[3]); uc[0],uc[1],uc[2],uc[3]);
goto cleanup; goto cleanup;
} }
_handle_msg(msg_thr, msg); /* handle_msg frees msg->data */ _handle_msg(msg_thr, msg); /* handle_msg frees msg->data */
cleanup: cleanup:
if ((msg->conn_fd >= 0) && slurm_close_accepted_conn(msg->conn_fd) < 0) if ((msg->conn_fd >= 0) && slurm_close_accepted_conn(msg->conn_fd) < 0)
......
...@@ -824,22 +824,21 @@ static int _message_socket_accept(eio_obj_t *obj, List objs) ...@@ -824,22 +824,21 @@ static int _message_socket_accept(eio_obj_t *obj, List objs)
int fd; int fd;
unsigned char *uc; unsigned char *uc;
short port; unsigned short port;
struct sockaddr_un addr; struct sockaddr_in addr;
slurm_msg_t *msg = NULL; slurm_msg_t *msg = NULL;
int len = sizeof(addr); int len = sizeof(addr);
int timeout = 0; /* slurm default value */ int timeout = 0; /* slurm default value */
int rc = 0;
debug3("Called _msg_socket_accept"); debug3("Called _msg_socket_accept");
while ((fd = accept(obj->fd, (struct sockaddr *)&addr, while ((fd = accept(obj->fd, (struct sockaddr *)&addr,
(socklen_t *)&len)) < 0) { (socklen_t *)&len)) < 0) {
if (errno == EINTR) if (errno == EINTR)
continue; continue;
if (errno == EAGAIN if (errno == EAGAIN ||
|| errno == ECONNABORTED errno == ECONNABORTED ||
|| errno == EWOULDBLOCK) { errno == EWOULDBLOCK) {
return SLURM_SUCCESS; return SLURM_SUCCESS;
} }
error("Error on msg accept socket: %m"); error("Error on msg accept socket: %m");
...@@ -852,8 +851,8 @@ static int _message_socket_accept(eio_obj_t *obj, List objs) ...@@ -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 /* Should not call slurm_get_addr() because the IP may not be
in /etc/hosts. */ in /etc/hosts. */
uc = (unsigned char *)&((struct sockaddr_in *)&addr)->sin_addr.s_addr; uc = (unsigned char *)&addr.sin_addr.s_addr;
port = ((struct sockaddr_in *)&addr)->sin_port; port = addr.sin_port;
debug2("step got message connection from %u.%u.%u.%u:%hu", debug2("step got message connection from %u.%u.%u.%u:%hu",
uc[0], uc[1], uc[2], uc[3], ntohs(port)); uc[0], uc[1], uc[2], uc[3], ntohs(port));
fflush(stdout); fflush(stdout);
...@@ -866,7 +865,7 @@ static int _message_socket_accept(eio_obj_t *obj, List objs) ...@@ -866,7 +865,7 @@ static int _message_socket_accept(eio_obj_t *obj, List objs)
* responses and timeouts. Raise the default timeout for srun. */ * responses and timeouts. Raise the default timeout for srun. */
timeout = slurm_get_msg_timeout() * 8000; timeout = slurm_get_msg_timeout() * 8000;
again: again:
if((rc = slurm_receive_msg(fd, msg, timeout)) != 0) { if(slurm_receive_msg(fd, msg, timeout) != 0) {
if (errno == EINTR) { if (errno == EINTR) {
goto again; goto again;
} }
...@@ -875,7 +874,7 @@ again: ...@@ -875,7 +874,7 @@ again:
goto cleanup; goto cleanup;
} }
_handle_msg(sls, msg); /* handle_msg frees msg */ _handle_msg(sls, msg); /* handle_msg frees msg->data */
cleanup: cleanup:
if ((msg->conn_fd >= 0) && slurm_close_accepted_conn(msg->conn_fd) < 0) if ((msg->conn_fd >= 0) && slurm_close_accepted_conn(msg->conn_fd) < 0)
error ("close(%d): %m", msg->conn_fd); error ("close(%d): %m", msg->conn_fd);
......
...@@ -486,11 +486,10 @@ static int _message_socket_accept(eio_obj_t *obj, List objs) ...@@ -486,11 +486,10 @@ static int _message_socket_accept(eio_obj_t *obj, List objs)
int fd; int fd;
unsigned char *uc; unsigned char *uc;
short port; unsigned short port;
struct sockaddr_un addr; struct sockaddr_in addr;
slurm_msg_t *msg = NULL; slurm_msg_t *msg = NULL;
int len = sizeof(addr); int len = sizeof(addr);
int timeout = 0; /* slurm default value */
debug3("Called _msg_socket_accept"); debug3("Called _msg_socket_accept");
...@@ -498,9 +497,9 @@ static int _message_socket_accept(eio_obj_t *obj, List objs) ...@@ -498,9 +497,9 @@ static int _message_socket_accept(eio_obj_t *obj, List objs)
(socklen_t *)&len)) < 0) { (socklen_t *)&len)) < 0) {
if (errno == EINTR) if (errno == EINTR)
continue; continue;
if ((errno == EAGAIN) || if (errno == EAGAIN ||
(errno == ECONNABORTED) || errno == ECONNABORTED ||
(errno == EWOULDBLOCK)) { errno == EWOULDBLOCK) {
return SLURM_SUCCESS; return SLURM_SUCCESS;
} }
error("Error on msg accept socket: %m"); error("Error on msg accept socket: %m");
...@@ -513,18 +512,16 @@ static int _message_socket_accept(eio_obj_t *obj, List objs) ...@@ -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 /* Should not call slurm_get_addr() because the IP may not be
in /etc/hosts. */ in /etc/hosts. */
uc = (unsigned char *)&((struct sockaddr_in *)&addr)->sin_addr.s_addr; uc = (unsigned char *)&addr.sin_addr.s_addr;
port = ((struct sockaddr_in *)&addr)->sin_port; port = addr.sin_port;
debug2("got message connection from %u.%u.%u.%u:%hu", debug2("got message connection from %u.%u.%u.%u:%hu",
uc[0], uc[1], uc[2], uc[3], ntohs(port)); uc[0], uc[1], uc[2], uc[3], ntohs(port));
fflush(stdout); fflush(stdout);
msg = xmalloc(sizeof(slurm_msg_t)); msg = xmalloc(sizeof(slurm_msg_t));
slurm_msg_t_init(msg); slurm_msg_t_init(msg);
timeout = slurm_get_msg_timeout() * 1000;
again: again:
if(slurm_receive_msg(fd, msg, timeout) != 0) { if(slurm_receive_msg(fd, msg, 0) != 0) {
if (errno == EINTR) { if (errno == EINTR) {
goto again; goto again;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment