summaryrefslogtreecommitdiff
path: root/src/udp.c
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2014-09-25 01:26:39 +0200
committerChristian Pointner <equinox@spreadspace.org>2014-09-25 01:26:39 +0200
commitd0dd288687557c4dc4d4ade3caf22eccf0e74ffa (patch)
treeef21a035f686ee35f00226e8caf32683c4babd3b /src/udp.c
parentadded timeout option (diff)
add callback for client timeout check
Diffstat (limited to 'src/udp.c')
-rw-r--r--src/udp.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/udp.c b/src/udp.c
index c4da533..2064e4f 100644
--- a/src/udp.c
+++ b/src/udp.c
@@ -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;
}