[pulseaudio-commits] r1965 - in /branches/lennart/src/pulsecore: protocol-simple.c socket-client.c

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Sun Oct 28 09:35:10 PDT 2007


Author: lennart
Date: Sun Oct 28 17:35:09 2007
New Revision: 1965

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=1965&root=pulseaudio&view=rev
Log:
fix error handling

Modified:
    branches/lennart/src/pulsecore/protocol-simple.c
    branches/lennart/src/pulsecore/socket-client.c

Modified: branches/lennart/src/pulsecore/protocol-simple.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/protocol-simple.c?rev=1965&root=pulseaudio&r1=1964&r2=1965&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/protocol-simple.c (original)
+++ branches/lennart/src/pulsecore/protocol-simple.c Sun Oct 28 17:35:09 2007
@@ -69,7 +69,7 @@
 PA_DECLARE_CLASS(connection);
 #define CONNECTION(o) (connection_cast(o))
 static PA_DEFINE_CHECK_TYPE(connection, pa_msgobject);
-                     
+
 struct pa_protocol_simple {
     pa_module *module;
     pa_core *core;
@@ -108,7 +108,7 @@
 
     if (!c->protocol)
         return;
-    
+
     if (c->sink_input) {
         pa_sink_input_unlink(c->sink_input);
         pa_sink_input_unref(c->sink_input);
@@ -130,7 +130,7 @@
         pa_iochannel_free(c->io);
         c->io = NULL;
     }
-    
+
     pa_assert_se(pa_idxset_remove_by_data(c->protocol->connections, c, NULL) == c);
     c->protocol = NULL;
     connection_unref(c);
@@ -141,7 +141,7 @@
     pa_assert(c);
 
     connection_unref(c);
-    
+
     if (c->playback.current_memblock)
         pa_memblock_unref(c->playback.current_memblock);
 
@@ -185,7 +185,7 @@
 
     if (r <= 0) {
 
-        if (errno == EINTR || errno == EAGAIN)
+        if (r < 0 && (errno == EINTR || errno == EAGAIN))
             return 0;
 
         pa_log_debug("read(): %s", r == 0 ? "EOF" : pa_cstrerror(errno));
@@ -284,7 +284,7 @@
         case CONNECTION_MESSAGE_REQUEST_DATA:
             do_work(c);
             break;
-            
+
         case CONNECTION_MESSAGE_POST_DATA:
 /*             pa_log("got data %u", chunk->length); */
             pa_memblockq_push_align(c->output_memblockq, chunk);
@@ -319,7 +319,7 @@
             pa_memblockq_push_align(c->input_memblockq, chunk);
 
 /*             pa_log("got data, %u", pa_memblockq_get_length(c->input_memblockq)); */
-            
+
             return 0;
         }
 
@@ -634,4 +634,3 @@
 
     pa_xfree(p);
 }
-

Modified: branches/lennart/src/pulsecore/socket-client.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/socket-client.c?rev=1965&root=pulseaudio&r1=1964&r2=1965&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/socket-client.c (original)
+++ branches/lennart/src/pulsecore/socket-client.c Sun Oct 28 17:35:09 2007
@@ -134,7 +134,7 @@
     pa_iochannel *io = NULL;
     int error;
     socklen_t lerror;
-    
+
     pa_assert(c);
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
     pa_assert(c->callback);
@@ -156,7 +156,7 @@
     }
 
     if (error != 0) {
-        pa_log_debug("connect(): %s", pa_cstrerror(errno));
+        pa_log_debug("connect(): %s", pa_cstrerror(error));
         errno = error;
         goto finish;
     }
@@ -179,7 +179,7 @@
 
 static void connect_fixed_cb(pa_mainloop_api *m, pa_defer_event *e, void *userdata) {
     pa_socket_client *c = userdata;
-    
+
     pa_assert(m);
     pa_assert(c);
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
@@ -196,13 +196,13 @@
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
     pa_assert(c->io_event == e);
     pa_assert(fd >= 0);
-    
+
     do_call(c);
 }
 
 static int do_connect(pa_socket_client *c, const struct sockaddr *sa, socklen_t len) {
     int r;
-    
+
     pa_assert(c);
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
     pa_assert(sa);
@@ -230,15 +230,15 @@
 
 pa_socket_client* pa_socket_client_new_ipv4(pa_mainloop_api *m, uint32_t address, uint16_t port) {
     struct sockaddr_in sa;
-    
+
     pa_assert(m);
     pa_assert(port > 0);
-    
+
     memset(&sa, 0, sizeof(sa));
     sa.sin_family = AF_INET;
     sa.sin_port = htons(port);
     sa.sin_addr.s_addr = htonl(address);
-    
+
     return pa_socket_client_new_sockaddr(m, (struct sockaddr*) &sa, sizeof(sa));
 }
 
@@ -246,7 +246,7 @@
 
 pa_socket_client* pa_socket_client_new_unix(pa_mainloop_api *m, const char *filename) {
     struct sockaddr_un sa;
-    
+
     pa_assert(m);
     pa_assert(filename);
 
@@ -307,11 +307,11 @@
 
 pa_socket_client* pa_socket_client_new_sockaddr(pa_mainloop_api *m, const struct sockaddr *sa, size_t salen) {
     pa_socket_client *c;
-    
+
     pa_assert(m);
     pa_assert(sa);
     pa_assert(salen > 0);
-    
+
     pa_assert_se(c = pa_socket_client_new(m));
 
     if (sockaddr_prepare(c, sa, salen) < 0)
@@ -375,7 +375,7 @@
     pa_assert(m);
     pa_assert(address);
     pa_assert(port > 0);
-    
+
     memset(&sa, 0, sizeof(sa));
     sa.sin6_family = AF_INET6;
     sa.sin6_port = htons(port);
@@ -390,7 +390,7 @@
     pa_socket_client *c = userdata;
     struct addrinfo *res = NULL;
     int ret;
-        
+
     pa_assert(m);
     pa_assert(c);
     pa_assert(PA_REFCNT_VALUE(c) >= 1);
@@ -432,7 +432,7 @@
 
 static void timeout_cb(pa_mainloop_api *m, pa_time_event *e, const struct timeval *tv, void *userdata) {
     pa_socket_client *c = userdata;
-        
+
     pa_assert(m);
     pa_assert(e);
     pa_assert(tv);
@@ -460,7 +460,7 @@
 pa_socket_client* pa_socket_client_new_string(pa_mainloop_api *m, const char*name, uint16_t default_port) {
     pa_socket_client *c = NULL;
     pa_parsed_address a;
-    
+
     pa_assert(m);
     pa_assert(name);
 




More information about the pulseaudio-commits mailing list