Browse Source

Increase queued count before pushing message.

Con Kolivas 13 years ago
parent
commit
05bc638d97
1 changed files with 4 additions and 1 deletions
  1. 4 1
      cgminer.c

+ 4 - 1
cgminer.c

@@ -3536,10 +3536,13 @@ static bool queue_request(struct thr_info *thr, bool needed)
 	    now.tv_sec - requested_tv_sec < scan_post)
 	    now.tv_sec - requested_tv_sec < scan_post)
 		return true;
 		return true;
 
 
+	inc_queued();
+
 	/* fill out work request message */
 	/* fill out work request message */
 	wc = calloc(1, sizeof(*wc));
 	wc = calloc(1, sizeof(*wc));
 	if (unlikely(!wc)) {
 	if (unlikely(!wc)) {
 		applog(LOG_ERR, "Failed to calloc wc in queue_request");
 		applog(LOG_ERR, "Failed to calloc wc in queue_request");
+		dec_queued();
 		return false;
 		return false;
 	}
 	}
 
 
@@ -3561,11 +3564,11 @@ static bool queue_request(struct thr_info *thr, bool needed)
 	if (unlikely(!tq_push(thr_info[work_thr_id].q, wc))) {
 	if (unlikely(!tq_push(thr_info[work_thr_id].q, wc))) {
 		applog(LOG_ERR, "Failed to tq_push in queue_request");
 		applog(LOG_ERR, "Failed to tq_push in queue_request");
 		workio_cmd_free(wc);
 		workio_cmd_free(wc);
+		dec_queued();
 		return false;
 		return false;
 	}
 	}
 
 
 	requested_tv_sec = now.tv_sec;
 	requested_tv_sec = now.tv_sec;
-	inc_queued();
 	return true;
 	return true;
 }
 }