Browse code

core: added clone buf support for WebSocket connections

Peter Dunkley authored on 17/06/2012 13:28:20
Showing 1 changed files
... ...
@@ -1035,6 +1035,8 @@ static int tcp_read_ws(struct tcp_connection *c, int* read_flags)
1035 1035
 #endif
1036 1036
 			bytes = tcp_read(c, read_flags);
1037 1037
 
1038
+		LM_INFO("read %d bytes\n", bytes);
1039
+
1038 1040
 		if (bytes <= 0)
1039 1041
 			return 0;
1040 1042
 	}
... ...
@@ -1168,6 +1170,11 @@ int receive_tcp_msg(char* tcpbuf, unsigned int len,
1168 1170
 		if(unlikely(con->req.flags&F_TCP_REQ_MSRP_FRAME))
1169 1171
 			return msrp_process_msg(tcpbuf, len, rcv_info, con);
1170 1172
 #endif
1173
+#ifdef READ_WS
1174
+		if(unlikely(con->flags & F_CONN_WS))
1175
+			return ws_process_msg(tcpbuf, len, rcv_info, con);
1176
+#endif
1177
+
1171 1178
 		return receive_msg(tcpbuf, len, rcv_info);
1172 1179
 	}
1173 1180
 
... ...
@@ -1210,12 +1217,20 @@ int receive_tcp_msg(char* tcpbuf, unsigned int len,
1210 1217
 #ifdef READ_MSRP
1211 1218
 	if(unlikely(con->req.flags&F_TCP_REQ_MSRP_FRAME))
1212 1219
 		return msrp_process_msg(buf, len, rcv_info, con);
1220
+#endif
1221
+#ifdef READ_WS
1222
+	if(unlikely(con->flags & F_CONN_WS))
1223
+		return ws_process_msg(buf, len, rcv_info, con);
1213 1224
 #endif
1214 1225
 	return receive_msg(buf, len, rcv_info);
1215 1226
 #else /* TCP_CLONE_RCVBUF */
1216 1227
 #ifdef READ_MSRP
1217 1228
 	if(unlikely(con->req.flags&F_TCP_REQ_MSRP_FRAME))
1218 1229
 		return msrp_process_msg(tcpbuf, len, rcv_info, con);
1230
+#endif
1231
+#ifdef READ_WS
1232
+	if(unlikely(con->flags & F_CONN_WS))
1233
+		return ws_process_msg(tcpbuf, len, rcv_info, con);
1219 1234
 #endif
1220 1235
 	return receive_msg(tcpbuf, len, rcv_info);
1221 1236
 #endif /* TCP_CLONE_RCVBUF */
... ...
@@ -1361,7 +1376,7 @@ again:
1361 1376
 #endif
1362 1377
 #ifdef READ_WS
1363 1378
 			if (unlikely(con->flags&F_CONN_WS)){
1364
-				ret = ws_process_msg(req->start, req->parsed-req->start,
1379
+				ret = receive_tcp_msg(req->start, req->parsed-req->start,
1365 1380
 									&con->rcv, con);
1366 1381
 			}else
1367 1382
 #endif