]> code.delx.au - pulseaudio/blobdiff - polyp/polyplib-context.c
Merge Pierre's changes
[pulseaudio] / polyp / polyplib-context.c
index e7ccda3e86714bb5ce6fd7c3e0f7487dc85a7382..f97d9b8270e907f58b15a1f172a9289e507914d9 100644 (file)
 #include <stdlib.h>
 #include <string.h>
 #include <sys/types.h>
-#include <sys/socket.h>
-#include <netdb.h>
 #include <unistd.h>
 #include <sys/stat.h>
 #include <errno.h>
-#include <sys/wait.h>
 #include <signal.h>
+#include <limits.h>
+
+#ifdef HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
+
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_NETDB_H
+#include <netdb.h>
+#endif
+
+#include "winsock.h"
 
 #include "polyplib-internal.h"
 #include "polyplib-context.h"
@@ -110,8 +121,10 @@ struct pa_context *pa_context_new(struct pa_mainloop_api *mainloop, const char *
     c->autospawn_lock_fd = -1;
     memset(&c->spawn_api, 0, sizeof(c->spawn_api));
     c->do_autospawn = 0;
-    
+
+#ifdef SIGPIPE    
     pa_check_signal_is_blocked(SIGPIPE);
+#endif
 
     c->conf = pa_client_conf_new();
     pa_client_conf_load(c->conf, NULL);
@@ -372,6 +385,8 @@ finish:
 
 static void on_connection(struct pa_socket_client *client, struct pa_iochannel*io, void *userdata);
 
+#ifndef OS_IS_WIN32
+
 static int context_connect_spawn(struct pa_context *c) {
     pid_t pid;
     int status, r;
@@ -485,6 +500,8 @@ fail:
     return -1;
 }
 
+#endif /* OS_IS_WIN32 */
+
 static int try_next_connection(struct pa_context *c) {
     char *u = NULL;
     int r = -1;
@@ -499,16 +516,18 @@ static int try_next_connection(struct pa_context *c) {
         
         if (!u) {
 
+#ifndef OS_IS_WIN32
             if (c->do_autospawn) {
                 r = context_connect_spawn(c);
                 goto finish;
             }
+#endif
             
             pa_context_fail(c, PA_ERROR_CONNECTIONREFUSED);
             goto finish;
         }
         
-/*          pa_log(__FILE__": Trying to connect to %s...\n", u);  */
+        pa_log_debug(__FILE__": Trying to connect to %s...\n", u);  
 
         pa_xfree(c->server);
         c->server = pa_xstrdup(u);
@@ -535,7 +554,7 @@ static void on_connection(struct pa_socket_client *client, struct pa_iochannel*i
     assert(client && c && c->state == PA_CONTEXT_CONNECTING);
 
     pa_context_ref(c);
-    
+
     pa_socket_client_unref(client);
     c->client = NULL;