From: mquinson Date: Sun, 27 Aug 2006 22:05:10 +0000 (+0000) Subject: Check PROPERLY whether there is more data to consume from the buffer (to avoid a... X-Git-Tag: v3.3~2605 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/8fdf9f364a9e9d694b395e9e45a2e2a4dcecf912?hp=a8210ef736c5ba76c193eb7150dc7562a54ff7fd 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 --- 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; }