From b49b3a3b2c1c7d849da7b4166b920e8c7f2008cc Mon Sep 17 00:00:00 2001 From: tewk <tewk@unknown> Date: Thu, 13 Jun 2002 22:02:35 +0000 Subject: [PATCH] Notice: that it is very wise to move your buffer foward as you repeat recv calls to keep from overwritting previously receieved information --- src/common/slurm_protocol_api.c | 2 -- src/common/slurm_protocol_socket_implementation.c | 4 +++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common/slurm_protocol_api.c b/src/common/slurm_protocol_api.c index e48caaf30ab..e89ef8d63d9 100644 --- a/src/common/slurm_protocol_api.c +++ b/src/common/slurm_protocol_api.c @@ -137,7 +137,6 @@ int slurm_receive_msg ( slurm_fd open_fd , slurm_msg_t * msg ) int rc ; unsigned int unpack_len ; unsigned int receive_len = SLURM_PROTOCOL_MAX_MESSAGE_BUFFER_SIZE ; -int i; if ( ( rc = _slurm_msg_recvfrom ( open_fd , buffer , receive_len, SLURM_PROTOCOL_NO_SEND_RECV_FLAGS , & (msg)->address ) ) == SLURM_SOCKET_ERROR ) { @@ -245,7 +244,6 @@ int slurm_receive_buffer ( slurm_fd open_fd , slurm_addr * source_address , slur char * buffer = buftemp ; header_t header ; int rc ; -int i; unsigned int unpack_len ; /* length left to upack */ unsigned int receive_len = SLURM_PROTOCOL_MAX_MESSAGE_BUFFER_SIZE ; /* buffer size */ diff --git a/src/common/slurm_protocol_socket_implementation.c b/src/common/slurm_protocol_socket_implementation.c index 1fc3f269fc3..b87014d0849 100644 --- a/src/common/slurm_protocol_socket_implementation.c +++ b/src/common/slurm_protocol_socket_implementation.c @@ -53,6 +53,7 @@ ssize_t _slurm_msg_recvfrom ( slurm_fd open_fd, char *buffer , size_t size , uin char size_buffer_temp [8] ; char * size_buffer = size_buffer_temp ; + char * moving_buffer = buffer ; unsigned int size_buffer_len = 8 ; unsigned int transmit_size ; unsigned int total_len ; @@ -75,7 +76,7 @@ ssize_t _slurm_msg_recvfrom ( slurm_fd open_fd, char *buffer , size_t size , uin while ( total_len < transmit_size ) { /* if ( ( recv_len = _slurm_recv ( connection_fd , buffer , transmit_size , NO_SEND_RECV_FLAGS ) ) == SLURM_SOCKET_ERROR ) */ - if ( ( recv_len = _slurm_recv ( open_fd , buffer , transmit_size , SLURM_PROTOCOL_NO_SEND_RECV_FLAGS ) ) == SLURM_SOCKET_ERROR ) + if ( ( recv_len = _slurm_recv ( open_fd , moving_buffer , transmit_size , SLURM_PROTOCOL_NO_SEND_RECV_FLAGS ) ) == SLURM_SOCKET_ERROR ) { info ( "Error receiving length of datagram. errno %i \n", errno ) ; return recv_len ; @@ -83,6 +84,7 @@ ssize_t _slurm_msg_recvfrom ( slurm_fd open_fd, char *buffer , size_t size , uin if ( recv_len >= 0 ) { total_len += recv_len ; + moving_buffer += recv_len ; } } /* -- GitLab