Commit 818427d0 authored by Youness Alaoui's avatar Youness Alaoui

example: Exit on Ctrl-D and send EOS signal to the other end

parent bcd83b68
...@@ -252,6 +252,10 @@ stdin_send_data_cb (GIOChannel *source, GIOCondition cond, ...@@ -252,6 +252,10 @@ stdin_send_data_cb (GIOChannel *source, GIOCondition cond,
g_free (line); g_free (line);
printf("> "); printf("> ");
fflush (stdout); fflush (stdout);
} else {
nice_agent_send(agent, stream_id, 1, 1, "\0");
// Ctrl-D was pressed.
g_main_loop_quit (gloop);
} }
return TRUE; return TRUE;
...@@ -269,6 +273,8 @@ static void ...@@ -269,6 +273,8 @@ static void
cb_nice_recv(NiceAgent *agent, guint stream_id, guint component_id, cb_nice_recv(NiceAgent *agent, guint stream_id, guint component_id,
guint len, gchar *buf, gpointer data) guint len, gchar *buf, gpointer data)
{ {
if (len == 1 && buf[0] == '\0')
g_main_loop_quit (gloop);
printf("%.*s", len, buf); printf("%.*s", len, buf);
fflush(stdout); fflush(stdout);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment