Commit c9b4f5c7579a00b728d01e671f268495da47a8e1

Con Kolivas 2013-03-07T15:34:44

Revert "Cope with out of order messages coming in upon attempting to auth_stratum." This reverts commit 237f67c6178bd8f4c5e9f807cdf9a010d17e9684.

diff --git a/util.c b/util.c
index dfbfc93..e15ab5a 100644
--- a/util.c
+++ b/util.c
@@ -1369,46 +1369,38 @@ bool auth_stratum(struct pool *pool)
 	json_error_t err;
 	bool ret = false;
 
-	pool->stratum_notify = false;
-
 	sprintf(s, "{\"id\": %d, \"method\": \"mining.authorize\", \"params\": [\"%s\", \"%s\"]}",
 		swork_id++, pool->rpc_user, pool->rpc_pass);
 
 	if (!stratum_send(pool, s, strlen(s)))
 		goto out;
 
-	/* Parse all data in the queue and break out should we run out of data
-	 * or we have successfully parsed a notify message. */
+	/* Parse all data in the queue and anything left should be auth */
 	while (42) {
 		sret = recv_line(pool);
 		if (!sret)
 			goto out;
-		if (parse_method(pool, sret)) {
+		if (parse_method(pool, sret))
 			free(sret);
-			if (pool->stratum_notify)
-				break;
-		} else
+		else
 			break;
 	}
 
-	if (!pool->stratum_notify) {
-		val = JSON_LOADS(sret, &err);
-		free(sret);
-		res_val = json_object_get(val, "result");
-		err_val = json_object_get(val, "error");
-
-		if (!res_val || json_is_false(res_val) || (err_val && !json_is_null(err_val)))  {
-			char *ss;
-
-			if (err_val)
-				ss = json_dumps(err_val, JSON_INDENT(3));
-			else
-				ss = strdup("(unknown reason)");
-			applog(LOG_WARNING, "JSON stratum auth failed: %s", ss);
-			free(ss);
-			goto out;
-		}
-		applog(LOG_WARNING, "Failed to auth stratum");
+	val = JSON_LOADS(sret, &err);
+	free(sret);
+	res_val = json_object_get(val, "result");
+	err_val = json_object_get(val, "error");
+
+	if (!res_val || json_is_false(res_val) || (err_val && !json_is_null(err_val)))  {
+		char *ss;
+
+		if (err_val)
+			ss = json_dumps(err_val, JSON_INDENT(3));
+		else
+			ss = strdup("(unknown reason)");
+		applog(LOG_WARNING, "JSON stratum auth failed: %s", ss);
+		free(ss);
+
 		goto out;
 	}