From patchwork Thu May 5 14:27:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= X-Patchwork-Id: 618982 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3r0y8F3Y83z9snm for ; Fri, 6 May 2016 00:33:49 +1000 (AEST) Received: from localhost ([::1]:53878 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ayKLX-0001Ph-Vd for incoming@patchwork.ozlabs.org; Thu, 05 May 2016 10:33:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57178) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ayKHO-00029V-Gl for qemu-devel@nongnu.org; Thu, 05 May 2016 10:29:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ayKHC-00055K-Vi for qemu-devel@nongnu.org; Thu, 05 May 2016 10:29:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37881) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ayKHC-00051r-PB for qemu-devel@nongnu.org; Thu, 05 May 2016 10:29:14 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9E55CC00355F for ; Thu, 5 May 2016 14:29:03 +0000 (UTC) Received: from catbus.gsslab.fab.redhat.com (dhcp-91.gsslab.fab.redhat.com [10.33.9.91]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u45ESue8014172; Thu, 5 May 2016 10:29:02 -0400 From: "Daniel P. Berrange" To: qemu-devel@nongnu.org Date: Thu, 5 May 2016 15:27:59 +0100 Message-Id: <1462458480-20555-6-git-send-email-berrange@redhat.com> In-Reply-To: <1462458480-20555-1-git-send-email-berrange@redhat.com> References: <1462458480-20555-1-git-send-email-berrange@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v1 5/6] scripts: ensure monitor socket has SO_REUSEADDR set X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Amit Shah , "Dr. David Alan Gilbert" , Juan Quintela Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" If tests use a TCP based monitor socket, the connection will go into a TIMED_WAIT state when the test exits. This will randomly prevent the test from being re-run without a certain time period. Set the SO_REUSEADDR flag on the socket to ensure we can immediately re-run the tests --- scripts/qmp/qmp.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/qmp/qmp.py b/scripts/qmp/qmp.py index 2d0d926..62d3651 100644 --- a/scripts/qmp/qmp.py +++ b/scripts/qmp/qmp.py @@ -43,6 +43,7 @@ class QEMUMonitorProtocol: self._debug = debug self.__sock = self.__get_sock() if server: + self.__sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) self.__sock.bind(self.__address) self.__sock.listen(1)