Received: from eggs.gnu.org ([2001:4830:134:3::10]:37932) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPrVj-0000YK-NQ for qemu-devel@nongnu.org; Wed, 20 Jul 2016 09:26:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bPrVi-0003Zz-P1 for qemu-devel@nongnu.org; Wed, 20 Jul 2016 09:26:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42465) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPrVi-0003Zu-Iu for qemu-devel@nongnu.org; Wed, 20 Jul 2016 09:26:02 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (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 38D173B720 for ; Wed, 20 Jul 2016 13:26:02 +0000 (UTC) From: "Daniel P. Berrange" Date: Wed, 20 Jul 2016 14:23:12 +0100 Message-Id: <1469020993-29426-6-git-send-email-berrange@redhat.com> In-Reply-To: <1469020993-29426-1-git-send-email-berrange@redhat.com> References: <1469020993-29426-1-git-send-email-berrange@redhat.com> Subject: [Qemu-devel] [PATCH v2 5/6] scripts: ensure monitor socket has SO_REUSEADDR set List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Juan Quintela , Amit Shah , "Dr. David Alan Gilbert" , Stefan Hajnoczi , "Daniel P. Berrange" 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 Signed-off-by: Daniel P. Berrange --- 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) -- 2.5.5