|
|
@ -104,14 +104,13 @@ int generator(proc_instance_t *pi) |
|
|
|
char *userpass = NULL; |
|
|
|
char *userpass = NULL; |
|
|
|
gbtbase_t gbt; |
|
|
|
gbtbase_t gbt; |
|
|
|
connsock_t cs; |
|
|
|
connsock_t cs; |
|
|
|
int ret = 0; |
|
|
|
int ret = 1; |
|
|
|
|
|
|
|
|
|
|
|
memset(&cs, 0, sizeof(cs)); |
|
|
|
memset(&cs, 0, sizeof(cs)); |
|
|
|
memset(&gbt, 0, sizeof(gbt)); |
|
|
|
memset(&gbt, 0, sizeof(gbt)); |
|
|
|
|
|
|
|
|
|
|
|
if (!extract_sockaddr(ckp->btcdurl, &cs.url, &cs.port)) { |
|
|
|
if (!extract_sockaddr(ckp->btcdurl, &cs.url, &cs.port)) { |
|
|
|
LOGWARNING("Failed to extract address from %s", ckp->btcdurl); |
|
|
|
LOGWARNING("Failed to extract address from %s", ckp->btcdurl); |
|
|
|
ret = 1; |
|
|
|
|
|
|
|
goto out; |
|
|
|
goto out; |
|
|
|
} |
|
|
|
} |
|
|
|
userpass = strdup(ckp->btcdauth); |
|
|
|
userpass = strdup(ckp->btcdauth); |
|
|
@ -120,14 +119,12 @@ int generator(proc_instance_t *pi) |
|
|
|
cs.auth = http_base64(userpass); |
|
|
|
cs.auth = http_base64(userpass); |
|
|
|
if (!cs.auth) { |
|
|
|
if (!cs.auth) { |
|
|
|
LOGWARNING("Failed to create base64 auth from %s", userpass); |
|
|
|
LOGWARNING("Failed to create base64 auth from %s", userpass); |
|
|
|
ret = 1; |
|
|
|
|
|
|
|
goto out; |
|
|
|
goto out; |
|
|
|
} |
|
|
|
} |
|
|
|
dealloc(userpass); |
|
|
|
dealloc(userpass); |
|
|
|
cs.fd = connect_socket(cs.url, cs.port); |
|
|
|
cs.fd = connect_socket(cs.url, cs.port); |
|
|
|
if (cs.fd < 0) { |
|
|
|
if (cs.fd < 0) { |
|
|
|
LOGWARNING("Failed to connect socket to %s:%s", cs.url, cs.port); |
|
|
|
LOGWARNING("Failed to connect socket to %s:%s", cs.url, cs.port); |
|
|
|
ret = 1; |
|
|
|
|
|
|
|
goto out; |
|
|
|
goto out; |
|
|
|
} |
|
|
|
} |
|
|
|
keep_sockalive(cs.fd); |
|
|
|
keep_sockalive(cs.fd); |
|
|
|