diff options
author | Christian Pointner <equinox@spreadspace.org> | 2014-09-25 01:26:39 +0200 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2014-09-25 01:26:39 +0200 |
commit | d0dd288687557c4dc4d4ade3caf22eccf0e74ffa (patch) | |
tree | ef21a035f686ee35f00226e8caf32683c4babd3b /src/udp.c | |
parent | added timeout option (diff) |
add callback for client timeout check
Diffstat (limited to 'src/udp.c')
-rw-r--r-- | src/udp.c | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -155,6 +155,13 @@ static gboolean on_udp_desc_ready(gint fd, GIOCondition cond, gpointer user_data return TRUE; } +gboolean check_client_timeout(gpointer user_data) +{ + struct udp_sinks* sinks = (struct udp_sinks*)user_data; + log_printf(DEBUG, "******************* checking timeout *******************: %d sec.", sinks->client_timeout_); + return TRUE; +} + static gboolean attach_udpsink(struct udp_sink* sink, const char* name, const char* prop) { GSocket *sock; @@ -172,6 +179,9 @@ static gboolean attach_udpsink(struct udp_sink* sink, const char* name, const ch gboolean attach_udpsinks(struct udp_sinks *sinks) { + if(!sinks) + return FALSE; + if(!attach_udpsink(&(sinks->rtp_video_), "RTP(video) IPv4", "used-socket") || !attach_udpsink(&(sinks->rtp_video_), "RTP(video) IPv6", "used-socket-v6") || !attach_udpsink(&(sinks->rtcp_video_), "RTCP(video) IPv4", "used-socket") || @@ -182,5 +192,10 @@ gboolean attach_udpsinks(struct udp_sinks *sinks) !attach_udpsink(&(sinks->rtcp_audio_), "RTCP(audio) IPv6", "used-socket-v6")) { return FALSE; } + if(sinks->client_timeout_ > 0) { + if(!g_timeout_add_seconds(1, check_client_timeout, sinks)) + return FALSE; + } + return TRUE; } |