From 8fdf9f364a9e9d694b395e9e45a2e2a4dcecf912 Mon Sep 17 00:00:00 2001 From: mquinson Date: Sun, 27 Aug 2006 22:05:10 +0000 Subject: [PATCH] Check PROPERLY whether there is more data to consume from the buffer (to avoid a select) git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@2754 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- src/gras/Transport/transport_plugin_tcp.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/gras/Transport/transport_plugin_tcp.c b/src/gras/Transport/transport_plugin_tcp.c index bf76ad732b..fef04c17f7 100644 --- a/src/gras/Transport/transport_plugin_tcp.c +++ b/src/gras/Transport/transport_plugin_tcp.c @@ -338,8 +338,7 @@ gras_trp_tcp_recv_withbuffer(gras_socket_t sock, got); } } - /* indicate to the gras_select function that there is more to read on this socket so that it does not actually select */ - sock->moredata = (bufsize != 0); + return got; } @@ -475,7 +474,10 @@ gras_trp_buf_recv(gras_socket_t sock, DEBUG4("New pos = %d; Still to receive = %ld of %ld. Ctn so far=(%s)", data->in_buf.pos,size - chunk_pos,size,hexa_str((unsigned char*)chunk,chunk_pos,0)); } - + /* indicate on need to the gras_select function that there is more to read on this socket so that it does not actually select */ + sock->moredata = (data->in_buf.size > data->in_buf.pos); + DEBUG1("There is %smore data",(sock->moredata?"":"no ")); + XBT_OUT; return chunk_pos; } -- 2.20.1