mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-22 20:44:19 +00:00
Parse anything in the stratum socket if it's full without waiting. Empty the socket even if a connection is not needed in case there are share returns.
This commit is contained in:
parent
eaa935b193
commit
944af31b99
@ -4643,7 +4643,7 @@ static void *stratum_thread(void *userdata)
|
|||||||
/* Check to see whether we need to maintain this connection
|
/* Check to see whether we need to maintain this connection
|
||||||
* indefinitely or just bring it up when we switch to this
|
* indefinitely or just bring it up when we switch to this
|
||||||
* pool */
|
* pool */
|
||||||
if (!cnx_needed(pool)) {
|
if (!sock_full(pool, false) && !cnx_needed(pool)) {
|
||||||
suspend_stratum(pool);
|
suspend_stratum(pool);
|
||||||
clear_stratum_shares(pool);
|
clear_stratum_shares(pool);
|
||||||
clear_pool_work(pool);
|
clear_pool_work(pool);
|
||||||
@ -4668,7 +4668,7 @@ static void *stratum_thread(void *userdata)
|
|||||||
* every minute so if we fail to receive any for 90 seconds we
|
* every minute so if we fail to receive any for 90 seconds we
|
||||||
* assume the connection has been dropped and treat this pool
|
* assume the connection has been dropped and treat this pool
|
||||||
* as dead */
|
* as dead */
|
||||||
if (unlikely(select(pool->sock + 1, &rd, NULL, NULL, &timeout) < 1))
|
if (!sock_full(pool, false) && select(pool->sock + 1, &rd, NULL, NULL, &timeout) < 1)
|
||||||
s = NULL;
|
s = NULL;
|
||||||
else
|
else
|
||||||
s = recv_line(pool);
|
s = recv_line(pool);
|
||||||
|
2
util.c
2
util.c
@ -930,7 +930,7 @@ bool stratum_send(struct pool *pool, char *s, ssize_t len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Check to see if Santa's been good to you */
|
/* Check to see if Santa's been good to you */
|
||||||
static bool sock_full(struct pool *pool, bool wait)
|
bool sock_full(struct pool *pool, bool wait)
|
||||||
{
|
{
|
||||||
SOCKETTYPE sock = pool->sock;
|
SOCKETTYPE sock = pool->sock;
|
||||||
struct timeval timeout;
|
struct timeval timeout;
|
||||||
|
1
util.h
1
util.h
@ -46,6 +46,7 @@ struct pool;
|
|||||||
enum dev_reason;
|
enum dev_reason;
|
||||||
struct cgpu_info;
|
struct cgpu_info;
|
||||||
bool stratum_send(struct pool *pool, char *s, ssize_t len);
|
bool stratum_send(struct pool *pool, char *s, ssize_t len);
|
||||||
|
bool sock_full(struct pool *pool, bool wait);
|
||||||
char *recv_line(struct pool *pool);
|
char *recv_line(struct pool *pool);
|
||||||
bool parse_method(struct pool *pool, char *s);
|
bool parse_method(struct pool *pool, char *s);
|
||||||
bool extract_sockaddr(struct pool *pool, char *url);
|
bool extract_sockaddr(struct pool *pool, char *url);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user