Browse Source

Merge branch 'master' into bfgminer

Conflicts:
	NEWS
Luke Dashjr 14 years ago
parent
commit
44aee1b01f
6 changed files with 128 additions and 49 deletions
  1. 77 0
      NEWS
  2. 3 4
      api.c
  3. 1 1
      configure.ac
  4. 1 1
      logging.c
  5. 24 21
      miner.c
  6. 22 22
      util.c

+ 77 - 0
NEWS

@@ -1,3 +1,80 @@
+BFGMiner Version 2.3.5 - April 28, 2012
+
+- Restarting cgminer leads to a socket that can't be bound for 60 seconds, so
+increase the interval that API binding waits to 30 seconds to minimise the
+number of times it will retry, spamming the logs.
+- Give a longpoll message for any longpoll that detects a block change, primary
+or backup, and also display which pool it was.
+- Decrease utility display to one decimal place.
+- Small cosmetic output alignment.
+- Add pool number to stale share message.
+- Add space to log output now that there is more screen real estate available.
+- Indentation clean up.
+- Merge branch 'master' of github.com:ckolivas/cgminer
+- Remove thread id display from rejected shares as well.
+- Merge pull request #185 from Diapolo/diakgcn
+- add goffset support for diakgcn with -v 1 and update kernel version
+- Set have_longpoll to true when there is at least one pool with longpoll.
+- Don't display the thread ID since it adds no useful information over the
+device number.
+- Don't display the first 8 bytes of a share since they will always be zero at
+>= 1 difficulty.
+- work->longpoll is reset across test_work_current so we need to recheck what
+pool it belongs to.
+- Use longpolls from backup pools with failover-only enabled just to check for
+block changes, but don't use them as work.
+- Start longpoll only after we have tried to extract the longpoll URL.
+- Check for submitold flag on resubmit of shares, and give different message for
+stale shares on retry.
+- Check for submitold before submitstale.
+- Don't force fresh curl connections on anything but longpoll threads.
+- Create one longpoll thread per pool, using backup pools for those pools that
+don't have longpoll.
+- Use the work created from the longpoll return only if we don't have
+failover-enabled, and only flag the work as a longpoll if it is the current
+pool.
+- This will work around the problem of trying to restart the single longpoll
+thread on pool changes that was leading to race conditions.
+- It will also have less work restarts from the multiple longpolls received from
+different pools.
+- Remove the ability to disable longpoll. It is not a useful feature and will
+conflict with planned changes to longpoll code.
+- Remove the invalid entries from the example configuration file.
+- Add support for latest ATI SDK on windows.
+- Export missing function from libztex.
+- miner.php change socktimeoutsec = 10 (it only waits once)
+- Bugfix: Make initial_args a const char** to satisfy exec argument type warning
+(on Windows only)
+- miner.php add a timeout so you don't sit and wait ... forever
+- Create discrete persistent submit and get work threads per pool, thus allowing
+all submitworks belonging to the same pool to reuse the same curl handle, and
+all getworks to reuse their own handle.
+- Use separate handles for submission to not make getwork potentially delay
+share submission which is time critical.
+- This will allow much more reusing of persistent connections instead of opening
+new ones which can flood routers.
+- This mandated a rework of the extra longpoll support (for when pools are
+switched) and this is managed by restarting longpoll cleanly and waiting for a
+thread join.
+- miner.php only show the current date header once
+- miner.php also add current time like single rig page
+- miner.php display rig 'when' table at top of the multi-rig summary page
+- README - add some Ztex details
+- api.c include zTex in the FPGA support list
+- api.c ensure 'devs' shows PGA's when only PGA code is compiled
+- cgminer.c sharelog code consistency and compile warning fix
+- README correct API version number
+- README spelling error
+- api.c combine all pairs of sprintfs()
+- api.c uncomment and use BLANK (and COMMA)
+- Code style cleanup
+- Annotating frequency changes with the changed from value
+- README clarification of 'notify' command
+- README update for API RPC 'devdetails'
+- api.c 'devdetails' list static details of devices
+- Using less heap space as my TP-Link seems to not handle this much
+
+
 BFGMiner Version 2.3.4 - April 26, 2012
 BFGMiner Version 2.3.4 - April 26, 2012
 
 
 - New maintainership of code with modular FPGA/GPU focus, under BFGMiner name
 - New maintainership of code with modular FPGA/GPU focus, under BFGMiner name

+ 3 - 4
api.c

@@ -2221,11 +2221,10 @@ void api(int api_thr_id)
 			if ((time(NULL) - bindstart) > 61)
 			if ((time(NULL) - bindstart) > 61)
 				break;
 				break;
 			else {
 			else {
-				applog(LOG_WARNING, "API bind to port %d failed - trying again in 15sec", port);
-				sleep(15);
+				applog(LOG_WARNING, "API bind to port %d failed - trying again in 30sec", port);
+				sleep(30);
 			}
 			}
-		}
-		else
+		} else
 			bound = 1;
 			bound = 1;
 	}
 	}
 
 

+ 1 - 1
configure.ac

@@ -2,7 +2,7 @@
 ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
 ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
 m4_define([v_maj], [2])
 m4_define([v_maj], [2])
 m4_define([v_min], [3])
 m4_define([v_min], [3])
-m4_define([v_mic], [4])
+m4_define([v_mic], [5])
 ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
 ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
 m4_define([v_ver], [v_maj.v_min.v_mic])
 m4_define([v_ver], [v_maj.v_min.v_mic])
 m4_define([lt_rev], m4_eval(v_maj + v_min))
 m4_define([lt_rev], m4_eval(v_maj + v_min))

+ 1 - 1
logging.c

@@ -63,7 +63,7 @@ void vapplog(int prio, const char *fmt, va_list ap)
 
 
 		len = 40 + strlen(fmt) + 22;
 		len = 40 + strlen(fmt) + 22;
 		f = alloca(len);
 		f = alloca(len);
-		sprintf(f, "[%d-%02d-%02d %02d:%02d:%02d] %s\n",
+		sprintf(f, " [%d-%02d-%02d %02d:%02d:%02d] %s\n",
 			tm->tm_year + 1900,
 			tm->tm_year + 1900,
 			tm->tm_mon + 1,
 			tm->tm_mon + 1,
 			tm->tm_mday,
 			tm->tm_mday,

+ 24 - 21
miner.c

@@ -1315,7 +1315,7 @@ static void get_statline(char *buf, struct cgpu_info *cgpu)
 		cgpu->api->get_statline_before(buf, cgpu);
 		cgpu->api->get_statline_before(buf, cgpu);
 	else
 	else
 		tailsprintf(buf, "               | ");
 		tailsprintf(buf, "               | ");
-	tailsprintf(buf, "(%ds):%.1f (avg):%.1f Mh/s | A:%d R:%d HW:%d U:%.2f/m",
+	tailsprintf(buf, "(%ds):%.1f (avg):%.1f Mh/s | A:%d R:%d HW:%d U:%.1f/m",
 		opt_log_interval,
 		opt_log_interval,
 		cgpu->rolling,
 		cgpu->rolling,
 		cgpu->total_mhashes / total_secs,
 		cgpu->total_mhashes / total_secs,
@@ -1697,7 +1697,7 @@ static bool submit_upstream_work(const struct work *work)
 			char reason[32];
 			char reason[32];
 
 
 			if (total_pools > 1)
 			if (total_pools > 1)
-				sprintf(where, " pool %d", work->pool->pool_no);
+				sprintf(where, "pool %d", work->pool->pool_no);
 			else
 			else
 				strcpy(where, "");
 				strcpy(where, "");
 
 
@@ -1716,8 +1716,8 @@ static bool submit_upstream_work(const struct work *work)
 			} else
 			} else
 				strcpy(reason, "");
 				strcpy(reason, "");
 
 
-			applog(LOG_NOTICE, "Rejected %s %s %d thread %d%s%s",
-			       hashshow, cgpu->api->name, cgpu->device_id, thr_id, where, reason);
+			applog(LOG_NOTICE, "Rejected %s %s %d %s%s",
+			       hashshow, cgpu->api->name, cgpu->device_id, where, reason);
 			sharelog(disposition, work);
 			sharelog(disposition, work);
 		}
 		}
 	}
 	}
@@ -2098,11 +2098,14 @@ static void *submit_work_thread(void *userdata)
 
 
 		if (stale_work(work, true)) {
 		if (stale_work(work, true)) {
 			if (pool->submit_old)
 			if (pool->submit_old)
-				applog(LOG_NOTICE, "Stale share detected, submitting as pool requested");
+				applog(LOG_NOTICE, "Stale share detected, submitting as pool %d requested",
+				       pool->pool_no);
 			else if (opt_submit_stale)
 			else if (opt_submit_stale)
-				applog(LOG_NOTICE, "Stale share detected, submitting as user requested");
+				applog(LOG_NOTICE, "Stale share detected from pool %d, submitting as user requested",
+					pool->pool_no);
 			else {
 			else {
-				applog(LOG_NOTICE, "Stale share detected, discarding");
+				applog(LOG_NOTICE, "Stale share detected from pool %d, discarding",
+					pool->pool_no);
 				sharelog("discard", work);
 				sharelog("discard", work);
 				total_stale++;
 				total_stale++;
 				pool->stale_shares++;
 				pool->stale_shares++;
@@ -2388,18 +2391,22 @@ static void test_work_current(struct work *work)
 		work_block++;
 		work_block++;
 
 
 		if (work->longpoll) {
 		if (work->longpoll) {
-			applog(LOG_NOTICE, "LONGPOLL detected new block on network, waiting on fresh work");
+			applog(LOG_NOTICE, "LONGPOLL from pool %d detected new block",
+			       work->pool->pool_no);
 			work->longpoll = false;
 			work->longpoll = false;
 		} else if (have_longpoll)
 		} else if (have_longpoll)
-			applog(LOG_NOTICE, "New block detected on network before longpoll, waiting on fresh work");
+			applog(LOG_NOTICE, "New block detected on network before longpoll");
 		else
 		else
-			applog(LOG_NOTICE, "New block detected on network, waiting on fresh work");
+			applog(LOG_NOTICE, "New block detected on network");
 		restart_threads();
 		restart_threads();
 	} else if (work->longpoll) {
 	} else if (work->longpoll) {
 		work->longpoll = false;
 		work->longpoll = false;
-		applog(LOG_NOTICE, "LONGPOLL requested work restart, waiting on fresh work");
-		work_block++;
-		restart_threads();
+		if (work->pool == current_pool()) {
+			applog(LOG_NOTICE, "LONGPOLL from pool %d requested work restart",
+				work->pool->pool_no);
+			work_block++;
+			restart_threads();
+		}
 	}
 	}
 out_free:
 out_free:
 	free(hexstr);
 	free(hexstr);
@@ -3215,7 +3222,7 @@ static void hashmeter(int thr_id, struct timeval *diff,
 	utility = total_accepted / ( total_secs ? total_secs : 1 ) * 60;
 	utility = total_accepted / ( total_secs ? total_secs : 1 ) * 60;
 	efficiency = total_getworks ? total_accepted * 100.0 / total_getworks : 0.0;
 	efficiency = total_getworks ? total_accepted * 100.0 / total_getworks : 0.0;
 
 
-	sprintf(statusline, "%s(%ds):%.1f (avg):%.1f Mh/s | Q:%d  A:%d  R:%d  HW:%d  E:%.0f%%  U:%.2f/m",
+	sprintf(statusline, "%s(%ds):%.1f (avg):%.1f Mh/s | Q:%d  A:%d  R:%d  HW:%d  E:%.0f%%  U:%.1f/m",
 		want_per_device_stats ? "ALL " : "",
 		want_per_device_stats ? "ALL " : "",
 		opt_log_interval, rolling, total_mhashes_done / total_secs,
 		opt_log_interval, rolling, total_mhashes_done / total_secs,
 		total_getworks, total_accepted, total_rejected, hw_errors, efficiency, utility);
 		total_getworks, total_accepted, total_rejected, hw_errors, efficiency, utility);
@@ -3816,7 +3823,6 @@ enum {
 /* Stage another work item from the work returned in a longpoll */
 /* Stage another work item from the work returned in a longpoll */
 static void convert_to_work(json_t *val, bool rolltime, struct pool *pool)
 static void convert_to_work(json_t *val, bool rolltime, struct pool *pool)
 {
 {
-	struct pool *cp = current_pool();
 	struct work *work, *work_clone;
 	struct work *work, *work_clone;
 	bool rc;
 	bool rc;
 
 
@@ -3830,10 +3836,7 @@ static void convert_to_work(json_t *val, bool rolltime, struct pool *pool)
 	}
 	}
 	work->pool = pool;
 	work->pool = pool;
 	work->rolltime = rolltime;
 	work->rolltime = rolltime;
-
-	/* Only flag this as longpoll work if the pool is the current pool */
-	if (pool == cp)
-		work->longpoll = true;
+	work->longpoll = true;
 
 
 	/* We'll be checking this work item twice, but we already know it's
 	/* We'll be checking this work item twice, but we already know it's
 	 * from a new block so explicitly force the new block detection now
 	 * from a new block so explicitly force the new block detection now
@@ -3841,8 +3844,8 @@ static void convert_to_work(json_t *val, bool rolltime, struct pool *pool)
 	 * allows testwork to know whether LP discovered the block or not. */
 	 * allows testwork to know whether LP discovered the block or not. */
 	test_work_current(work);
 	test_work_current(work);
 
 
-	/* Don't use as work if we have failover-only enabled */
-	if (pool != cp && opt_fail_only) {
+	/* Don't use backup LPs as work if we have failover-only enabled */
+	if (pool != current_pool() && opt_fail_only) {
 		free_work(work);
 		free_work(work);
 		return;
 		return;
 	}
 	}

+ 22 - 22
util.c

@@ -484,29 +484,29 @@ bool hex2bin(unsigned char *p, const char *hexstr, size_t len)
    storing the result in RESULT.
    storing the result in RESULT.
    Return 1 if the difference is negative, otherwise 0.  */
    Return 1 if the difference is negative, otherwise 0.  */
 
 
-int
-timeval_subtract (
-     struct timeval *result, struct timeval *x, struct timeval *y)
+int timeval_subtract(struct timeval *result, struct timeval *x, struct timeval *y)
 {
 {
-  /* Perform the carry for the later subtraction by updating Y. */
-  if (x->tv_usec < y->tv_usec) {
-    int nsec = (y->tv_usec - x->tv_usec) / 1000000 + 1;
-    y->tv_usec -= 1000000 * nsec;
-    y->tv_sec += nsec;
-  }
-  if (x->tv_usec - y->tv_usec > 1000000) {
-    int nsec = (x->tv_usec - y->tv_usec) / 1000000;
-    y->tv_usec += 1000000 * nsec;
-    y->tv_sec -= nsec;
-  }
-
-  /* Compute the time remaining to wait.
-     `tv_usec' is certainly positive. */
-  result->tv_sec = x->tv_sec - y->tv_sec;
-  result->tv_usec = x->tv_usec - y->tv_usec;
-
-  /* Return 1 if result is negative. */
-  return x->tv_sec < y->tv_sec;
+	/* Perform the carry for the later subtraction by updating Y. */
+	if (x->tv_usec < y->tv_usec) {
+		int nsec = (y->tv_usec - x->tv_usec) / 1000000 + 1;
+
+		y->tv_usec -= 1000000 * nsec;
+		y->tv_sec += nsec;
+	}
+	if (x->tv_usec - y->tv_usec > 1000000) {
+		int nsec = (x->tv_usec - y->tv_usec) / 1000000;
+
+		y->tv_usec += 1000000 * nsec;
+		y->tv_sec -= nsec;
+	}
+
+	/* Compute the time remaining to wait.
+	 * `tv_usec' is certainly positive. */
+	result->tv_sec = x->tv_sec - y->tv_sec;
+	result->tv_usec = x->tv_usec - y->tv_usec;
+
+	/* Return 1 if result is negative. */
+	return x->tv_sec < y->tv_sec;
 }
 }
 
 
 bool fulltest(const unsigned char *hash, const unsigned char *target)
 bool fulltest(const unsigned char *hash, const unsigned char *target)