Browse Source

Drop proxy connections on failing to submit messages

master
Con Kolivas 11 years ago
parent
commit
65a8b3d9fb
  1. 9
      src/generator.c
  2. 2
      src/stratifier.c

9
src/generator.c

@ -269,7 +269,7 @@ out:
static json_t *find_notify(json_t *val) static json_t *find_notify(json_t *val)
{ {
int arr_size, i; int arr_size, i;
json_t *ret; json_t *ret = NULL;
const char *entry; const char *entry;
if (!json_is_array(val)) if (!json_is_array(val))
@ -951,6 +951,7 @@ static void *proxy_send(void *arg)
char *jobid; char *jobid;
json_t *val; json_t *val;
uint32_t id; uint32_t id;
bool ret;
mutex_lock(&proxi->psend_lock); mutex_lock(&proxi->psend_lock);
if (!proxi->psends) if (!proxi->psends)
@ -982,10 +983,14 @@ static void *proxy_send(void *arg)
"id", json_object_get(msg->json_msg, "id"), "id", json_object_get(msg->json_msg, "id"),
"method", "mining.submit"); "method", "mining.submit");
free(jobid); free(jobid);
send_json_msg(cs, val); ret = send_json_msg(cs, val);
json_decref(val); json_decref(val);
json_decref(msg->json_msg); json_decref(msg->json_msg);
free(msg); free(msg);
if (!ret) {
LOGWARNING("Failed to send msg in proxy_send, dropping to reconnect");
close(cs->fd);
}
} }
return NULL; return NULL;
} }

2
src/stratifier.c

@ -1300,7 +1300,7 @@ static json_t *parse_submit(stratum_instance_t *client, json_t *json_msg,
bool share = false, result = false, invalid = true, submit = false; bool share = false, result = false, invalid = true, submit = false;
const char *user, *job_id, *nonce2, *ntime, *nonce; const char *user, *job_id, *nonce2, *ntime, *nonce;
char hexhash[68], sharehash[32], *logdir; char hexhash[68], sharehash[32], *logdir;
double diff, wdiff, sdiff = -1; double diff, wdiff = 0, sdiff = -1;
char idstring[20]; char idstring[20];
uint32_t ntime32; uint32_t ntime32;
char *fname, *s; char *fname, *s;

Loading…
Cancel
Save