Browse Source

Merge commit 'cdddd4b' into bfgminer

Conflicts:
	util.h
Luke Dashjr 12 years ago
parent
commit
1c47c4fbcb
2 changed files with 5 additions and 4 deletions
  1. 3 3
      util.c
  2. 2 1
      util.h

+ 3 - 3
util.c

@@ -1371,7 +1371,7 @@ static enum send_ret __stratum_send(struct pool *pool, char *s, ssize_t len)
 	return SEND_OK;
 	return SEND_OK;
 }
 }
 
 
-bool stratum_send(struct pool *pool, char *s, ssize_t len)
+bool _stratum_send(struct pool *pool, char *s, ssize_t len, bool force)
 {
 {
 	enum send_ret ret = SEND_INACTIVE;
 	enum send_ret ret = SEND_INACTIVE;
 
 
@@ -1379,7 +1379,7 @@ bool stratum_send(struct pool *pool, char *s, ssize_t len)
 		applog(LOG_DEBUG, "Pool %u: SEND: %s", pool->pool_no, s);
 		applog(LOG_DEBUG, "Pool %u: SEND: %s", pool->pool_no, s);
 
 
 	mutex_lock(&pool->stratum_lock);
 	mutex_lock(&pool->stratum_lock);
-	if (pool->stratum_active)
+	if (pool->stratum_active || force)
 		ret = __stratum_send(pool, s, len);
 		ret = __stratum_send(pool, s, len);
 	mutex_unlock(&pool->stratum_lock);
 	mutex_unlock(&pool->stratum_lock);
 
 
@@ -2114,7 +2114,7 @@ resend:
 			sprintf(s, "{\"id\": %d, \"method\": \"mining.subscribe\", \"params\": [\""PACKAGE"/"VERSION"\"]}", swork_id++);
 			sprintf(s, "{\"id\": %d, \"method\": \"mining.subscribe\", \"params\": [\""PACKAGE"/"VERSION"\"]}", swork_id++);
 	}
 	}
 
 
-	if (__stratum_send(pool, s, strlen(s)) != SEND_OK) {
+	if (!_stratum_send(pool, s, strlen(s), true)) {
 		applog(LOG_DEBUG, "Failed to send s in initiate_stratum");
 		applog(LOG_DEBUG, "Failed to send s in initiate_stratum");
 		goto out;
 		goto out;
 	}
 	}

+ 2 - 1
util.h

@@ -101,7 +101,8 @@ bool time_less(struct timeval *a, struct timeval *b);
 void copy_time(struct timeval *dest, const struct timeval *src);
 void copy_time(struct timeval *dest, const struct timeval *src);
 double us_tdiff(struct timeval *end, struct timeval *start);
 double us_tdiff(struct timeval *end, struct timeval *start);
 double tdiff(struct timeval *end, struct timeval *start);
 double tdiff(struct timeval *end, struct timeval *start);
-bool stratum_send(struct pool *pool, char *s, ssize_t len);
+bool _stratum_send(struct pool *pool, char *s, ssize_t len, bool force);
+#define stratum_send(pool, s, len)  _stratum_send(pool, s, len, false)
 bool sock_full(struct pool *pool);
 bool sock_full(struct pool *pool);
 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);