From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47765) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XZQ6j-0007AV-AW for qemu-devel@nongnu.org; Wed, 01 Oct 2014 16:02:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XZQ6f-0004OR-39 for qemu-devel@nongnu.org; Wed, 01 Oct 2014 16:02:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:4843) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XZQ6e-0004OF-Rp for qemu-devel@nongnu.org; Wed, 01 Oct 2014 16:02:37 -0400 Message-ID: <542C5197.30506@redhat.com> Date: Wed, 01 Oct 2014 13:10:15 -0600 From: Eric Blake MIME-Version: 1.0 References: <1411675641-16189-1-git-send-email-minyard@acm.org> <1411675641-16189-6-git-send-email-minyard@acm.org> In-Reply-To: <1411675641-16189-6-git-send-email-minyard@acm.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="XbvT7hTxmroS22Pgc9kI9Jk7CrDr9laG3" Subject: Re: [Qemu-devel] [PATCH 5/6] qemu-char: Add reconnecting to client sockets List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: minyard@acm.org, qemu-devel@nongnu.org Cc: mjg59@srcf.ucam.org, mst@redhat.com, hwd@huawei.com, bcketchum@gmail.com, Corey Minyard , afaerber@suse.de This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --XbvT7hTxmroS22Pgc9kI9Jk7CrDr9laG3 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 09/25/2014 02:07 PM, minyard@acm.org wrote: > From: Corey Minyard >=20 > Adds a "reconnect" option to socket backends that gives a reconnect > timeout. This only applies to client sockets. If the other end > of a socket closes the connection, qemu will attempt to reconnect > after the given number of seconds. >=20 > Signed-off-by: Corey Minyard > --- > qapi-schema.json | 15 ++++++---- > qemu-char.c | 88 ++++++++++++++++++++++++++++++++++++++++++++++++= ++++---- > qemu-options.hx | 20 ++++++++----- > 3 files changed, 105 insertions(+), 18 deletions(-) >=20 > =20 > +static gboolean socket_reconnect_timeout(gpointer opaque); > + Do you really need a forward declaration of this static function, or can you just stick the body of the function here? > @@ -2964,6 +2979,10 @@ static void tcp_chr_close(CharDriverState *chr) > TCPCharDriver *s =3D chr->opaque; > int i; > =20 > + if (s->reconnect_timer) { > + g_source_remove(s->reconnect_timer); > + s->reconnect_timer =3D 0; TAB damage. > @@ -3023,7 +3063,10 @@ static bool qemu_chr_open_socket_fd(CharDriverSt= ate *chr, Error **errp) > =20 > if (s->is_listen) { > fd =3D socket_listen(s->addr, errp); > - } else { > + } else if (s->reconnect_time) { > + fd =3D socket_connect(s->addr, errp, qemu_chr_socket_connected, chr);= > + return (fd >=3D 0); More TAB damage. Also, the () in the return are not necessary. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --XbvT7hTxmroS22Pgc9kI9Jk7CrDr9laG3 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 iQEcBAEBCAAGBQJULFGXAAoJEKeha0olJ0NqiY0H/jNNgy5V4DiooEAVlLMUfVtU 5qDCjBMshYTLbvrXspXme4aTX/Yq8QLhtycEHCus90Yy+vovmP1fFz5rbpCpEHFk +QFbD9V/eimDgjQ/yDb/PdRS/GyFA6iLT+J9vw+BtuKGQDox970jHxDmwdQVMS/v Drl/wi9ODPPAGiuZVeUi+Gx/066zTZT/PlS8PkALiey/e1wErLAsDABnDBnU8fOW +SMbPJlieFkEOXx0fNx+7oxdLZ5KNIWdetSx+aRcMR3y1NSBHLHTVgN+X+098O+N Dfc6badzoau8cSRm24UmEYE7SFSvQcdxPGk2kOSCSRZBWUkNiB0G4WC+dv4X6U0= =o0yw -----END PGP SIGNATURE----- --XbvT7hTxmroS22Pgc9kI9Jk7CrDr9laG3--