]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Add mod_sofia support for setting socket TCP keepalive
authorTravis Cross <tc@traviscross.com>
Tue, 11 Feb 2014 06:02:54 +0000 (06:02 +0000)
committerTravis Cross <tc@traviscross.com>
Tue, 11 Feb 2014 06:40:10 +0000 (06:40 +0000)
Some OSes like linux provide a mechanism for sending TCP keepalive
pings.  Sofia provides its own mechanism for doing this in userspace.
We shouldn't conflate these two mechanisms.

FS-6104

src/mod/endpoints/mod_sofia/mod_sofia.h
src/mod/endpoints/mod_sofia/sofia.c

index b42a6bcdce2e2276e2ca146c7df9277d1883df59..1e64bc981ca5195dad412caf6c8bacadc4b9525d 100644 (file)
@@ -282,6 +282,7 @@ typedef enum {
        PFLAG_FIRE_MESSAGE_EVENTS,
        PFLAG_SEND_DISPLAY_UPDATE,
        PFLAG_RUNNING_TRANS,
+       PFLAG_SOCKET_TCP_KEEPALIVE,
        PFLAG_TCP_KEEPALIVE,
        PFLAG_TCP_PINGPONG,
        PFLAG_TCP_PING2PONG,
@@ -719,6 +720,7 @@ struct sofia_profile {
        uint32_t rtp_digit_delay;
        switch_queue_t *event_queue;
        switch_thread_t *thread;                
+       int socket_tcp_keepalive;
        int tcp_keepalive;
        int tcp_pingpong;
        int tcp_ping2pong;
index 11cd3fc0f8b3e49d35db2d8667719ebaaff968ff..0104840ca1a061f5634df45d72cb4ebb2bce4a1b 100644 (file)
@@ -2478,6 +2478,8 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
                                                                         TPTAG_PINGPONG(profile->tcp_ping2pong)),
                                                          TAG_IF(sofia_test_pflag(profile, PFLAG_DISABLE_SRV503),
                                                                         NTATAG_SRV_503(0)),                                                                     
+                                                         TAG_IF(sofia_test_pflag(profile, PFLAG_SOCKET_TCP_KEEPALIVE),
+                                                                        TPTAG_KEEPALIVE(profile->socket_tcp_keepalive)),
                                                          TAG_IF(sofia_test_pflag(profile, PFLAG_TCP_KEEPALIVE),
                                                                         TPTAG_KEEPALIVE(profile->tcp_keepalive)),                                                                       
                                                          NTATAG_DEFAULT_PROXY(profile->outbound_proxy),
@@ -3727,6 +3729,9 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
                                        } else if (!strcasecmp(var, "sip-capture") && switch_true(val)) {
                                                sofia_set_flag(profile, TFLAG_CAPTURE);
                                                nua_set_params(profile->nua, TPTAG_CAPT(mod_sofia_globals.capture_server), TAG_END());                                          
+                                       } else if (!strcasecmp(var, "socket-tcp-keepalive") && !zstr(val)) {
+                                               profile->socket_tcp_keepalive = atoi(val);
+                                               sofia_set_pflag(profile, PFLAG_SOCKET_TCP_KEEPALIVE);
                                        } else if (!strcasecmp(var, "tcp-keepalive") && !zstr(val)) {
                                                profile->tcp_keepalive = atoi(val);
                                                sofia_set_pflag(profile, PFLAG_TCP_KEEPALIVE);