Skip to content
Snippets Groups Projects
Commit b49b3a3b authored by tewk's avatar tewk
Browse files

Notice: that it is very wise to move your buffer foward as you repeat recv calls to keep

from overwritting previously receieved information
parent 57c528d3
No related branches found
No related tags found
No related merge requests found
...@@ -137,7 +137,6 @@ int slurm_receive_msg ( slurm_fd open_fd , slurm_msg_t * msg ) ...@@ -137,7 +137,6 @@ int slurm_receive_msg ( slurm_fd open_fd , slurm_msg_t * msg )
int rc ; int rc ;
unsigned int unpack_len ; unsigned int unpack_len ;
unsigned int receive_len = SLURM_PROTOCOL_MAX_MESSAGE_BUFFER_SIZE ; 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 ) 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 ...@@ -245,7 +244,6 @@ int slurm_receive_buffer ( slurm_fd open_fd , slurm_addr * source_address , slur
char * buffer = buftemp ; char * buffer = buftemp ;
header_t header ; header_t header ;
int rc ; int rc ;
int i;
unsigned int unpack_len ; /* length left to upack */ unsigned int unpack_len ; /* length left to upack */
unsigned int receive_len = SLURM_PROTOCOL_MAX_MESSAGE_BUFFER_SIZE ; /* buffer size */ unsigned int receive_len = SLURM_PROTOCOL_MAX_MESSAGE_BUFFER_SIZE ; /* buffer size */
......
...@@ -53,6 +53,7 @@ ssize_t _slurm_msg_recvfrom ( slurm_fd open_fd, char *buffer , size_t size , uin ...@@ -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_temp [8] ;
char * size_buffer = size_buffer_temp ; char * size_buffer = size_buffer_temp ;
char * moving_buffer = buffer ;
unsigned int size_buffer_len = 8 ; unsigned int size_buffer_len = 8 ;
unsigned int transmit_size ; unsigned int transmit_size ;
unsigned int total_len ; unsigned int total_len ;
...@@ -75,7 +76,7 @@ ssize_t _slurm_msg_recvfrom ( slurm_fd open_fd, char *buffer , size_t size , uin ...@@ -75,7 +76,7 @@ ssize_t _slurm_msg_recvfrom ( slurm_fd open_fd, char *buffer , size_t size , uin
while ( total_len < transmit_size ) 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 ( 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 ) ; info ( "Error receiving length of datagram. errno %i \n", errno ) ;
return recv_len ; return recv_len ;
...@@ -83,6 +84,7 @@ ssize_t _slurm_msg_recvfrom ( slurm_fd open_fd, char *buffer , size_t size , uin ...@@ -83,6 +84,7 @@ ssize_t _slurm_msg_recvfrom ( slurm_fd open_fd, char *buffer , size_t size , uin
if ( recv_len >= 0 ) if ( recv_len >= 0 )
{ {
total_len += recv_len ; total_len += recv_len ;
moving_buffer += recv_len ;
} }
} }
/* /*
......
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