summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2013-06-05 15:11:23 +0200
committerYorhel <git@yorhel.nl>2013-06-05 15:11:23 +0200
commitabd11f530f2e7e7f29fa3ecf1d350fc59022b494 (patch)
tree387acbdfd273e5208a12426f0d14ad5905796fa7
parentb4d70aa2a0d4e568b1b7bc5b50be294b28c3e89e (diff)
Update deps + make use of new yuri library
m---------deps0
-rw-r--r--src/hub/connection.c8
2 files changed, 6 insertions, 2 deletions
diff --git a/deps b/deps
-Subproject 7091f3f7e29033dd1210bc9d48d58d3bf5cbb04
+Subproject 1ad9ca7a5fa51921b83ecd2f637c76e12ac8fd7
diff --git a/src/hub/connection.c b/src/hub/connection.c
index d535334..9b7589e 100644
--- a/src/hub/connection.c
+++ b/src/hub/connection.c
@@ -205,20 +205,23 @@ static void hub_conn_connect(hub_t *h, const char *addr, DBusMessage *msg) {
assert(hub_conn_state(h) == HUBC_IDLE || hub_conn_state(h) == HUBC_TIMER);
yuri_t uri;
- if(yuri_parse(addr, &uri)) {
+ if(yuri_parse_copy(addr, &uri)) {
yinfo("%d: Address '%s' is invalid", h->id, addr);
if(msg)
dbo_sendfree(dbus_message_new_error(msg, DBUS_ERROR_INVALID_ARGS, "Invalid address format"));
hub_conn_disconnect(h, 0, NULL, NULL);
+ free(uri.buf);
return;
}
h->proto = strcmp(uri.scheme, "adc") == 0 || strcmp(uri.scheme, "adcs") == 0 ? &hub_adc : &hub_nmdc;
+ h->c.istls = strcmp(uri.scheme, "adcs") == 0 || strcmp(uri.scheme, "nmdcs") == 0;
if(!uri.port && h->proto == &hub_adc) {
yinfo("%d: Address '%s' is missing a port", h->id, addr);
if(msg)
dbo_sendfree(dbus_message_new_error(msg, DBUS_ERROR_INVALID_ARGS, "Missing port"));
hub_conn_disconnect(h, 0, NULL, NULL);
+ free(uri.buf);
return;
}
if(!uri.port)
@@ -232,7 +235,6 @@ static void hub_conn_connect(hub_t *h, const char *addr, DBusMessage *msg) {
}
dbo_hubc_KeyprintSHA256_set(h, &h->c.props, "");
- h->c.istls = strncmp(addr, "adcs://", 7) == 0 || strncmp(addr, "nmdcs://", 7) == 0;
/* TODO: Set bind addresses, if requested */
h->c.con = calloc(1, sizeof(net_connect_t));
@@ -244,6 +246,8 @@ static void hub_conn_connect(hub_t *h, const char *addr, DBusMessage *msg) {
if(hub_conn_state(h) == HUBC_TIMER)
ev_timer_stop(EV_DEFAULT_UC_ &h->c.timer);
dbo_hubc_ConnectState_set(h, &h->c.props, HUBC_BUSY);
+
+ free(uri.buf);
}