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<address@hidden>
---
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?