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 1168
 		if(unlikely(con->req.flags&F_TCP_REQ_MSRP_FRAME))
1169 1169
 			return msrp_process_msg(tcpbuf, len, rcv_info, con);
1170 1170
 #endif
1171
+#ifdef READ_WS
1172
+		if(unlikely(con->flags & F_CONN_WS))
1173
+			return ws_process_msg(tcpbuf, len, rcv_info, con);
1174
+#endif
1175
+
1171 1176
 		return receive_msg(tcpbuf, len, rcv_info);
1172 1177
 	}
1173 1178
 
... ...
@@ -1211,12 +1218,20 @@ int receive_tcp_msg(char* tcpbuf, unsigned int len,
1211 1211
 	if(unlikely(con->req.flags&F_TCP_REQ_MSRP_FRAME))
1212 1212
 		return msrp_process_msg(buf, len, rcv_info, con);
1213 1213
 #endif
1214
+#ifdef READ_WS
1215
+	if(unlikely(con->flags & F_CONN_WS))
1216
+		return ws_process_msg(buf, len, rcv_info, con);
1217
+#endif
1214 1218
 	return receive_msg(buf, len, rcv_info);
1215 1219
 #else /* TCP_CLONE_RCVBUF */
1216 1220
 #ifdef READ_MSRP
1217 1221
 	if(unlikely(con->req.flags&F_TCP_REQ_MSRP_FRAME))
1218 1222
 		return msrp_process_msg(tcpbuf, len, rcv_info, con);
1219 1223
 #endif
1224
+#ifdef READ_WS
1225
+	if(unlikely(con->flags & F_CONN_WS))
1226
+		return ws_process_msg(tcpbuf, len, rcv_info, con);
1227
+#endif
1220 1228
 	return receive_msg(tcpbuf, len, rcv_info);
1221 1229
 #endif /* TCP_CLONE_RCVBUF */
1222 1230
 }
... ...
@@ -1361,7 +1376,7 @@ again:
1361 1361
 #endif
1362 1362
 #ifdef READ_WS
1363 1363
 			if (unlikely(con->flags&F_CONN_WS)){
1364
-				ret = ws_process_msg(req->start, req->parsed-req->start,
1364
+				ret = receive_tcp_msg(req->start, req->parsed-req->start,
1365 1365
 									&con->rcv, con);
1366 1366
 			}else
1367 1367
 #endif