From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=46598 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PE4W1-0005xw-Pq for qemu-devel@nongnu.org; Thu, 04 Nov 2010 14:26:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PE4W0-0006Xc-MN for qemu-devel@nongnu.org; Thu, 04 Nov 2010 14:26:25 -0400 Received: from e1.ny.us.ibm.com ([32.97.182.141]:35387) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PE4W0-0006XQ-J7 for qemu-devel@nongnu.org; Thu, 04 Nov 2010 14:26:24 -0400 Received: from d01relay05.pok.ibm.com (d01relay05.pok.ibm.com [9.56.227.237]) by e1.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id oA4IIrlt000652 for ; Thu, 4 Nov 2010 14:18:53 -0400 Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by d01relay05.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id oA4IQNS6168338 for ; Thu, 4 Nov 2010 14:26:23 -0400 Received: from d01av01.pok.ibm.com (loopback [127.0.0.1]) by d01av01.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id oA4IQN61015003 for ; Thu, 4 Nov 2010 14:26:23 -0400 Message-ID: <4CD2FACE.3000906@linux.vnet.ibm.com> Date: Thu, 04 Nov 2010 13:26:22 -0500 From: Michael Roth MIME-Version: 1.0 References: <1288798090-7127-1-git-send-email-mdroth@linux.vnet.ibm.com> <1288798090-7127-14-git-send-email-mdroth@linux.vnet.ibm.com> <1288833682.2846.99.camel@aglitke> In-Reply-To: <1288833682.2846.99.camel@aglitke> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [RFC][RESEND][PATCH v1 13/15] virtproxy: add read handler for proxied connections List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Adam Litke Cc: abeekhof@redhat.com, agl@linux.vnet.ibm.com, qemu-devel@nongnu.org, aliguori@linux.vnet.ibm.com On 11/03/2010 08:21 PM, Adam Litke wrote: > On Wed, 2010-11-03 at 10:28 -0500, Michael Roth wrote: >> reads data from client/server connections as they become readable, then >> sends the data over the channel >> >> Signed-off-by: Michael Roth >> --- >> virtproxy.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ >> 1 files changed, 80 insertions(+), 0 deletions(-) >> >> diff --git a/virtproxy.c b/virtproxy.c >> index 86a8e5b..f3f7f46 100644 >> --- a/virtproxy.c >> +++ b/virtproxy.c >> @@ -200,6 +200,86 @@ static VPIForward *get_iforward(const VPDriver *drv, const char *service_id) >> return NULL; >> } >> >> +/* read handler for proxied connections */ >> +static void vp_conn_read(void *opaque) >> +{ >> + VPConn *conn = opaque; >> + VPDriver *drv = conn->drv; >> + VPPacket pkt; >> + char buf[VP_CONN_DATA_LEN]; >> + int fd, count, ret; >> + bool client; >> + >> + TRACE("called with opaque: %p, drv: %p", opaque, drv); >> + >> + if (conn->state != VP_STATE_CONNECTED) { >> + LOG("invalid connection state"); >> + return; >> + } >> + >> + if (conn->type != VP_CONN_CLIENT&& conn->type != VP_CONN_SERVER) { >> + LOG("invalid connection type"); >> + return; >> + } > > When either of these happen (or some of the other errors below), would > it make sense to close and clean up this connection since you're now in > an invalid state? > Yah, should definitely clean it up if that happens.