Module: sip-router
Branch: pd/websocket
Commit: 636a6dabd14e08f2255e52a58353822642deda10
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=636a6da…
Author: Peter Dunkley <peter.dunkley(a)crocodile-rcs.com>
Committer: Peter Dunkley <peter.dunkley(a)crocodile-rcs.com>
Date: Fri Jun 29 23:08:19 2012 +0100
modules/websocket: Make sure that all WebSocket messages are sent on connections that
already exist
- This is the same as using set_forward_no_connect() and
set_reply_no_connect() in kamailio.cfg. But this means it will
always happen automatically for WebSocket messages.
- This is important as a WebSocket server cannot create connections -
so we always have to use one that already exists.
---
modules/websocket/ws_frame.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/modules/websocket/ws_frame.c b/modules/websocket/ws_frame.c
index 66c797f..ca66582 100644
--- a/modules/websocket/ws_frame.c
+++ b/modules/websocket/ws_frame.c
@@ -260,6 +260,11 @@ static int encode_and_send_ws_frame(ws_frame_t *frame, conn_close_t
conn_close)
from = &local_addr;
}
+ /* Regardless of what has been set before _always_ use existing
+ connections for WebSockets. This is required because a WebSocket
+ server (which Kamailio is) CANNOT create connections. */
+ dst.send_flags.f |= SND_F_FORCE_CON_REUSE;
+
if (tcp_send(&dst, from, send_buf, frame_length) < 0)
{
STATS_TX_DROPS;