From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49096) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XbD9j-0003QH-4x for qemu-devel@nongnu.org; Mon, 06 Oct 2014 14:37:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XbD9c-0004tU-ER for qemu-devel@nongnu.org; Mon, 06 Oct 2014 14:37:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48892) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XbD9c-0004tK-7G for qemu-devel@nongnu.org; Mon, 06 Oct 2014 14:37:04 -0400 Message-ID: <5432E14A.8030105@redhat.com> Date: Mon, 06 Oct 2014 12:36:58 -0600 From: Eric Blake MIME-Version: 1.0 References: <1412618363-14968-1-git-send-email-minyard@acm.org> <1412618363-14968-2-git-send-email-minyard@acm.org> In-Reply-To: <1412618363-14968-2-git-send-email-minyard@acm.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="CErBcqDhMXTCHk8Jp1M7rbgwjuvjkb2Gw" Subject: Re: [Qemu-devel] [PATCH 1/2] qemu-char: Fix reconnect socket error reporting List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: minyard@acm.org, qemu-devel@nongnu.org Cc: Corey Minyard This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --CErBcqDhMXTCHk8Jp1M7rbgwjuvjkb2Gw Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 10/06/2014 11:59 AM, minyard@acm.org wrote: > From: Corey Minyard >=20 > If reconnect was set, errors wouldn't always be reported. > Fix that and also only report a connect error once until a > connection has been made. >=20 > The primary purpose of this is to tell the user that a > connection failed so they can know they need to figure out > what went wrong. So we don't want to spew too much > out here, just enough so they know. >=20 > Signed-off-by: Corey Minyard > --- > qemu-char.c | 47 ++++++++++++++++++++++++++++++++--------------- > 1 file changed, 32 insertions(+), 15 deletions(-) > + bool connect_err_reported; > } TCPCharDriver; > =20 > static gboolean socket_reconnect_timeout(gpointer opaque); > @@ -2521,6 +2522,17 @@ static void qemu_chr_socket_restart_timer(CharDr= iverState *chr) > socket_reconnect_timeou= t, chr); > } > =20 > +static void check_report_connect_error(CharDriverState *chr, const cha= r *str) > +{ > + TCPCharDriver *s =3D chr->opaque; > + > + if (!s->connect_err_reported) { > + error_report("%s char device %s\n", str, chr->label); No \n at the end of an error_report() message. > + s->connect_err_reported =3D 1; s/1/true/ since you typed it as bool. > + } > + qemu_chr_socket_restart_timer(chr); > +} > + > static gboolean tcp_chr_accept(GIOChannel *chan, GIOCondition cond, vo= id *opaque); > =20 > #ifndef _WIN32 > @@ -3045,12 +3057,14 @@ static void qemu_chr_finish_socket_connection(C= harDriverState *chr, int fd) > static void qemu_chr_socket_connected(int fd, void *opaque) > { > CharDriverState *chr =3D opaque; > + TCPCharDriver *s =3D chr->opaque; > =20 > if (fd < 0) { > - qemu_chr_socket_restart_timer(chr); > + check_report_connect_error(chr, "Unable to connect to"); Works in English, but if there is ever translation of the message printed in check_report_connect_error, you are probably doing translators a disservice by splitting a sentence into two parts separated by a number of lines of code. (Spoken by one who has never contributed a translation, so take with a grain of salt) > return; > } > =20 > + s->connect_err_reported =3D 0; s/0/false/ --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --CErBcqDhMXTCHk8Jp1M7rbgwjuvjkb2Gw Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg iQEcBAEBCAAGBQJUMuFKAAoJEKeha0olJ0Nq/TQH/A9dN8O1cAHVfwi/DqD90Ycc xCU7NLv/B+jwhy+CppXSknCuXzLpF6caNOczpzEpvsvPeN5MhIiTVGJnP+FbbM6N tqUSiFlJoKKBn5m798ePzi5czT7oIXu8Zg4Uvo5xwovftsuvo7qnWY5Nx/4ZFbwf l2h8aFaJWgI7veoRaamyvbAAowDuVjXPA/gm/3A05vtWVeWv9Z7m+WR8Pz9SwBHh MzojLG5k3pwkuIBhKL39YIH+NikVx1ko4P340RcbNwx9ttHQzUcaUXimHVtUCO0v GTsJuUvGAVMGzyLi+zI9dZ+/jtyRiXQP0E0kNN5hyboIT+HA0Vc0sknaAAoNyCQ= =jp4e -----END PGP SIGNATURE----- --CErBcqDhMXTCHk8Jp1M7rbgwjuvjkb2Gw--