[sr-dev] git:pd/websocket: core: added clone buf support for WebSocket connections

Peter Dunkley peter.dunkley at crocodile-rcs.com
Sun Jun 17 15:30:29 CEST 2012


Module: sip-router
Branch: pd/websocket
Commit: c04689c5f5017456a9a5c0f6b617e13ee6f7a1d6
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=c04689c5f5017456a9a5c0f6b617e13ee6f7a1d6

Author: Peter Dunkley <peter.dunkley at crocodile-rcs.com>
Committer: Peter Dunkley <peter.dunkley at crocodile-rcs.com>
Date:   Sun Jun 17 14:28:20 2012 +0100

core: added clone buf support for WebSocket connections

---

 tcp_read.c |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/tcp_read.c b/tcp_read.c
index 187e9a1..5c45469 100644
--- a/tcp_read.c
+++ b/tcp_read.c
@@ -1035,6 +1035,8 @@ static int tcp_read_ws(struct tcp_connection *c, int* read_flags)
 #endif
 			bytes = tcp_read(c, read_flags);
 
+		LM_INFO("read %d bytes\n", bytes);
+
 		if (bytes <= 0)
 			return 0;
 	}
@@ -1168,6 +1170,11 @@ int receive_tcp_msg(char* tcpbuf, unsigned int len,
 		if(unlikely(con->req.flags&F_TCP_REQ_MSRP_FRAME))
 			return msrp_process_msg(tcpbuf, len, rcv_info, con);
 #endif
+#ifdef READ_WS
+		if(unlikely(con->flags & F_CONN_WS))
+			return ws_process_msg(tcpbuf, len, rcv_info, con);
+#endif
+
 		return receive_msg(tcpbuf, len, rcv_info);
 	}
 
@@ -1211,12 +1218,20 @@ int receive_tcp_msg(char* tcpbuf, unsigned int len,
 	if(unlikely(con->req.flags&F_TCP_REQ_MSRP_FRAME))
 		return msrp_process_msg(buf, len, rcv_info, con);
 #endif
+#ifdef READ_WS
+	if(unlikely(con->flags & F_CONN_WS))
+		return ws_process_msg(buf, len, rcv_info, con);
+#endif
 	return receive_msg(buf, len, rcv_info);
 #else /* TCP_CLONE_RCVBUF */
 #ifdef READ_MSRP
 	if(unlikely(con->req.flags&F_TCP_REQ_MSRP_FRAME))
 		return msrp_process_msg(tcpbuf, len, rcv_info, con);
 #endif
+#ifdef READ_WS
+	if(unlikely(con->flags & F_CONN_WS))
+		return ws_process_msg(tcpbuf, len, rcv_info, con);
+#endif
 	return receive_msg(tcpbuf, len, rcv_info);
 #endif /* TCP_CLONE_RCVBUF */
 }
@@ -1361,7 +1376,7 @@ again:
 #endif
 #ifdef READ_WS
 			if (unlikely(con->flags&F_CONN_WS)){
-				ret = ws_process_msg(req->start, req->parsed-req->start,
+				ret = receive_tcp_msg(req->start, req->parsed-req->start,
 									&con->rcv, con);
 			}else
 #endif




More information about the sr-dev mailing list