mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-10 14:58:01 +00:00
Append \n in the sock_send function instead of adding it when constructing json in stratum.
This commit is contained in:
parent
d416d22381
commit
b86a893981
8
util.c
8
util.c
@ -846,6 +846,7 @@ bool extract_sockaddr(struct pool *pool, char *url)
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Send a single command across a socket, appending \n to it */
|
||||
static bool sock_send(int sock, char *s, ssize_t len)
|
||||
{
|
||||
ssize_t sent = 0;
|
||||
@ -853,6 +854,9 @@ static bool sock_send(int sock, char *s, ssize_t len)
|
||||
if (opt_protocol)
|
||||
applog(LOG_DEBUG, "SEND: %s", s);
|
||||
|
||||
strcat(s, "\n");
|
||||
len++;
|
||||
|
||||
while (len > 0 ) {
|
||||
sent = send(sock, s + sent, len, 0);
|
||||
if (SOCKETFAIL(sent))
|
||||
@ -1006,7 +1010,7 @@ bool auth_stratum(struct pool *pool)
|
||||
bool ret = false;
|
||||
|
||||
s = alloca(RECVSIZE);
|
||||
sprintf(s, "{\"id\": %d, \"method\": \"mining.authorize\", \"params\": [\"%s\", \"%s\"]}\n",
|
||||
sprintf(s, "{\"id\": %d, \"method\": \"mining.authorize\", \"params\": [\"%s\", \"%s\"]}",
|
||||
pool->swork.id++, pool->rpc_user, pool->rpc_pass);
|
||||
|
||||
while (sock_full(pool->sock, false)) {
|
||||
@ -1033,7 +1037,7 @@ bool initiate_stratum(struct pool *pool)
|
||||
bool ret = false;
|
||||
|
||||
s = alloca(RECVSIZE);
|
||||
sprintf(s, "{\"id\": %d, \"method\": \"mining.subscribe\", \"params\": []}\n", pool->swork.id++);
|
||||
sprintf(s, "{\"id\": %d, \"method\": \"mining.subscribe\", \"params\": []}", pool->swork.id++);
|
||||
|
||||
pool->sock = socket(AF_INET, SOCK_STREAM, 0);
|
||||
if (pool->sock == INVSOCK)
|
||||
|
Loading…
Reference in New Issue
Block a user