diff options
| -rw-r--r-- | polyp/client-conf-x11.c | 11 | ||||
| -rw-r--r-- | polyp/pax11publish.c | 21 | ||||
| -rw-r--r-- | polyp/polyplib-context.c | 18 | ||||
| -rw-r--r-- | polyp/protocol-esound.c | 3 | ||||
| -rw-r--r-- | polyp/socket-client.c | 3 | 
5 files changed, 33 insertions, 23 deletions
diff --git a/polyp/client-conf-x11.c b/polyp/client-conf-x11.c index eb471033..383aa64e 100644 --- a/polyp/client-conf-x11.c +++ b/polyp/client-conf-x11.c @@ -15,7 +15,7 @@    You should have received a copy of the GNU Lesser General Public License    along with polypaudio; if not, write to the Free Software -  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-13071    USA.  ***/ @@ -48,11 +48,10 @@ int pa_client_conf_from_x11(struct pa_client_conf *c, const char *dname) {          goto finish;      } -    if (!pa_x11_get_prop(d, "POLYP_SERVER", t, sizeof(t)))  -        goto finish; - -    pa_xfree(c->default_server); -    c->default_server = pa_xstrdup(t); +    if (pa_x11_get_prop(d, "POLYP_SERVER", t, sizeof(t))) { +        pa_xfree(c->default_server); +        c->default_server = pa_xstrdup(t); +    }      if (pa_x11_get_prop(d, "POLYP_SINK", t, sizeof(t))) {          pa_xfree(c->default_sink); diff --git a/polyp/pax11publish.c b/polyp/pax11publish.c index 206ab1cb..a1cb006a 100644 --- a/polyp/pax11publish.c +++ b/polyp/pax11publish.c @@ -96,10 +96,8 @@ int main(int argc, char *argv[]) {      switch (mode) {          case DUMP: {              char t[1024]; -            if (!pa_x11_get_prop(d, "POLYP_SERVER", t, sizeof(t)))  -                goto finish; - -            printf("Server: %s\n", t); +            if (pa_x11_get_prop(d, "POLYP_SERVER", t, sizeof(t)))  +                printf("Server: %s\n", t);              if (pa_x11_get_prop(d, "POLYP_SOURCE", t, sizeof(t)))                  printf("Source: %s\n", t);              if (pa_x11_get_prop(d, "POLYP_SINK", t, sizeof(t))) @@ -112,11 +110,8 @@ int main(int argc, char *argv[]) {          case IMPORT: {              char t[1024]; -            if (!pa_x11_get_prop(d, "POLYP_SERVER", t, sizeof(t)))  -                goto finish; - -            printf("POLYP_SERVER='%s'\nexport POLYP_SERVER\n", t); -             +            if (pa_x11_get_prop(d, "POLYP_SERVER", t, sizeof(t)))  +                printf("POLYP_SERVER='%s'\nexport POLYP_SERVER\n", t);              if (pa_x11_get_prop(d, "POLYP_SOURCE", t, sizeof(t)))                  printf("POLYP_SOURCE='%s'\nexport POLYP_SOURCE\n", t);              if (pa_x11_get_prop(d, "POLYP_SINK", t, sizeof(t))) @@ -155,10 +150,14 @@ int main(int argc, char *argv[]) {                  goto finish;              } +            pa_x11_del_prop(d, "POLYP_SERVER"); +            pa_x11_del_prop(d, "POLYP_SINK"); +            pa_x11_del_prop(d, "POLYP_SOURCE");              pa_x11_del_prop(d, "POLYP_ID"); - +            pa_x11_del_prop(d, "POLYP_COOKIE"); +                          if (server) -                pa_x11_set_prop(d, "POLYP_SERVER", c->default_server); +                pa_x11_set_prop(d, "POLYP_SERVER", server);              else if (c->default_server)                  pa_x11_set_prop(d, "POLYP_SERVER", c->default_server);              else { diff --git a/polyp/polyplib-context.c b/polyp/polyplib-context.c index 517fcbeb..e7ccda3e 100644 --- a/polyp/polyplib-context.c +++ b/polyp/polyplib-context.c @@ -512,7 +512,7 @@ static int try_next_connection(struct pa_context *c) {          pa_xfree(c->server);          c->server = pa_xstrdup(u); -         +          if (!(c->client = pa_socket_client_new_string(c->mainloop, u, PA_NATIVE_DEFAULT_PORT)))              continue; @@ -564,7 +564,6 @@ int pa_context_connect(struct pa_context *c, const char *server, int spawn, cons      if (!server)          server = c->conf->default_server; -      pa_context_ref(c);      assert(!c->server_list); @@ -580,14 +579,23 @@ int pa_context_connect(struct pa_context *c, const char *server, int spawn, cons          /* Prepend in reverse order */ -        if ((d = getenv("DISPLAY"))) -            c->server_list = pa_strlist_prepend(c->server_list, d); +        if ((d = getenv("DISPLAY"))) { +            char *e; +            d = pa_xstrdup(d); +            if ((e = strchr(d, ':'))) +                *e = 0; + +            if (*d) +                c->server_list = pa_strlist_prepend(c->server_list, d); + +            pa_xfree(d); +        }          c->server_list = pa_strlist_prepend(c->server_list, "tcp6:localhost");          c->server_list = pa_strlist_prepend(c->server_list, "localhost");          c->server_list = pa_strlist_prepend(c->server_list, pa_runtime_path(PA_NATIVE_DEFAULT_UNIX_SOCKET, ufn, sizeof(ufn))); -        /* Wrap the connection attempts in a single transaction for sane autospwan locking */ +        /* Wrap the connection attempts in a single transaction for sane autospawn locking */          if (spawn && c->conf->autospawn) {              char lf[PATH_MAX]; diff --git a/polyp/protocol-esound.c b/polyp/protocol-esound.c index d9ed66b9..744ad4ed 100644 --- a/polyp/protocol-esound.c +++ b/polyp/protocol-esound.c @@ -714,7 +714,8 @@ static int do_read(struct connection *c) {          assert(c->read_data_length < sizeof(c->request));          if ((r = pa_iochannel_read(c->io, ((uint8_t*) &c->request) + c->read_data_length, sizeof(c->request) - c->read_data_length)) <= 0) { -            pa_log(__FILE__": read() failed: %s\n", r == 0 ? "EOF" : strerror(errno)); +            if (r != 0) +                pa_log_warn(__FILE__": read() failed: %s\n", strerror(errno));              return -1;          } diff --git a/polyp/socket-client.c b/polyp/socket-client.c index 0581e553..4ec42dab 100644 --- a/polyp/socket-client.c +++ b/polyp/socket-client.c @@ -263,6 +263,9 @@ struct pa_socket_client* pa_socket_client_new_string(struct pa_mainloop_api *m,      if (pa_parse_address(name, &a) < 0)          return NULL; +    if (!a.port) +        a.port = default_port; +          switch (a.type) {          case PA_PARSED_ADDRESS_UNIX:              c = pa_socket_client_new_unix(m, a.path_or_host);  | 
