]> code.delx.au - pulseaudio/blobdiff - src/modules/rtp/rtsp_client.c
Merge remote branch 'origin/master-tx'
[pulseaudio] / src / modules / rtp / rtsp_client.c
index 629328ade026f9dc6868112c1615cca55061678f..915c1072e3f00a36ea097e5bbe7c12ab4de57b20 100644 (file)
@@ -30,6 +30,7 @@
 #include <arpa/inet.h>
 #include <unistd.h>
 #include <sys/ioctl.h>
+#include <netinet/in.h>
 
 #ifdef HAVE_SYS_FILIO_H
 #include <sys/filio.h>
@@ -213,11 +214,13 @@ static void line_callback(pa_ioline *line, const char *s, void *userdata) {
         /* End of headers */
         /* We will have a header left from our looping iteration, so add it in :) */
         if (c->last_header) {
+            char *tmp = pa_strbuf_tostring_free(c->header_buffer);
             /* This is not a continuation header so let's dump it into our proplist */
-            pa_headerlist_puts(c->response_headers, c->last_header, pa_strbuf_tostring_free(c->header_buffer));
+            pa_headerlist_puts(c->response_headers, c->last_header, tmp);
+            pa_xfree(tmp);
             pa_xfree(c->last_header);
             c->last_header = NULL;
-            c->header_buffer= NULL;
+            c->header_buffer = NULL;
         }
 
         pa_log_debug("Full response received. Dispatching");
@@ -239,9 +242,11 @@ static void line_callback(pa_ioline *line, const char *s, void *userdata) {
     }
 
     if (c->last_header) {
+        char *tmp = pa_strbuf_tostring_free(c->header_buffer);
         /* This is not a continuation header so let's dump the full
           header/value into our proplist */
-        pa_headerlist_puts(c->response_headers, c->last_header, pa_strbuf_tostring_free(c->header_buffer));
+        pa_headerlist_puts(c->response_headers, c->last_header, tmp);
+        pa_xfree(tmp);
         pa_xfree(c->last_header);
         c->last_header = NULL;
         c->header_buffer = NULL;
@@ -332,7 +337,7 @@ int pa_rtsp_connect(pa_rtsp_client *c) {
     pa_xfree(c->session);
     c->session = NULL;
 
-    if (!(c->sc = pa_socket_client_new_string(c->mainloop, c->hostname, c->port))) {
+    if (!(c->sc = pa_socket_client_new_string(c->mainloop, TRUE, c->hostname, c->port))) {
         pa_log("failed to connect to server '%s:%d'", c->hostname, c->port);
         return -1;
     }
@@ -451,6 +456,8 @@ static int rtsp_exec(pa_rtsp_client* c, const char* cmd,
     l = pa_iochannel_write(c->io, hdrs, strlen(hdrs));
     pa_xfree(hdrs);
 
+    /* FIXME: this is broken, not necessarily all bytes are written */
+
     return 0;
 }