From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49980) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bc7XG-0007iy-NF for qemu-devel@nongnu.org; Tue, 23 Aug 2016 04:58:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bc7XB-0001Jq-Ng for qemu-devel@nongnu.org; Tue, 23 Aug 2016 04:58:17 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:7177) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bc7XA-0001DH-RR for qemu-devel@nongnu.org; Tue, 23 Aug 2016 04:58:13 -0400 From: "Gaohaifeng (A)" Date: Tue, 23 Aug 2016 08:57:44 +0000 Message-ID: <47CEA9C0E570484FBF22EF0D7EBCE5B5357D7C69@szxema505-mbx.china.huawei.com> Content-Language: zh-CN MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] A question about this commit 9894dc0cdcc397ee5b26370bc53da6d360a363c2 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "berrange@redhat.com" , "pbonzini@redhat.com" , "Lilijun (Jerry)" , zangchuanqiang , qemu devel Hi Daniel & Paolo, Commit 9894dc0c "char: convert from GIOChannel to QIOChannel", about the below code segment: -static gboolean tcp_chr_read(GIOChannel *chan, GIOCondition cond, void *op= aque) +static gboolean tcp_chr_read(QIOChannel *chan, GIOCondition cond, void *op= aque) { CharDriverState *chr =3D opaque; TCPCharDriver *s =3D chr->opaque; @@ -2938,9 +2801,7 @@ static gboolean tcp_chr_read(GIOChannel *chan, GIOCon= dition cond, void *opaque) if (len > s->max_size) len =3D s->max_size; size =3D tcp_chr_recv(chr, (void *)buf, len); - if (size =3D=3D 0 || - (size < 0 && - socket_error() !=3D EAGAIN && socket_error() !=3D EWOULDBLOCK)) { + if (size =3D=3D 0 || size =3D=3D -1) { /* connection closed */ tcp_chr_disconnect(chr); } else if (size > 0) { The old version will not call tcp_chr_disconnect when error is not EAGAIN. The new version will call tcp_chr_disconnect when size=3D=3D-1. From the tc= p_chr_recv function we see EAGIN will return -1, so EAGIN will call tcp_chr= _disconnect. We meet an issue when Guest VM use DPDK(1.6.0) l2fwd, it may exit since lin= k status is not up. The link is down because tcp_chr_disconnect will set it= . Can you explain it why EAGIN here changes the behavior ? Thanks, Haifeng Gao