Browse Source

SGW: Add X-Mining-Identifier header to inform devices what they are represented by in BFGMiner

Luke Dashjr 12 years ago
parent
commit
e1cbcbceaf
1 changed files with 6 additions and 1 deletions
  1. 6 1
      driver-getwork.c

+ 6 - 1
driver-getwork.c

@@ -249,6 +249,7 @@ int handle_getwork(struct MHD_Connection *conn, bytes_t *upbuf)
 		        rejreason ? "false" : "true", idstr);
 		        rejreason ? "false" : "true", idstr);
 		resp = MHD_create_response_from_buffer(replysz, reply, MHD_RESPMEM_MUST_FREE);
 		resp = MHD_create_response_from_buffer(replysz, reply, MHD_RESPMEM_MUST_FREE);
 		getwork_prepare_resp(resp);
 		getwork_prepare_resp(resp);
+		MHD_add_response_header(resp, "X-Mining-Identifier", cgpu->proc_repr);
 		if (rejreason)
 		if (rejreason)
 			MHD_add_response_header(resp, "X-Reject-Reason", rejreason);
 			MHD_add_response_header(resp, "X-Reject-Reason", rejreason);
 		ret = MHD_queue_response(conn, 200, resp);
 		ret = MHD_queue_response(conn, 200, resp);
@@ -258,7 +259,10 @@ int handle_getwork(struct MHD_Connection *conn, bytes_t *upbuf)
 	
 	
 	if (cgpu->deven == DEV_DISABLED)
 	if (cgpu->deven == DEV_DISABLED)
 	{
 	{
-		ret = getwork_error(conn, -10, "Virtual device has been disabled", idstr, idstr_sz);
+		resp = getwork_gen_error(-10, "Virtual device has been disabled", idstr, idstr_sz);
+		MHD_add_response_header(resp, "X-Mining-Identifier", cgpu->proc_repr);
+		ret = MHD_queue_response(conn, 500, resp);
+		MHD_destroy_response(resp);
 		goto out;
 		goto out;
 	}
 	}
 	
 	
@@ -280,6 +284,7 @@ int handle_getwork(struct MHD_Connection *conn, bytes_t *upbuf)
 		
 		
 		resp = MHD_create_response_from_buffer(replysz, reply, MHD_RESPMEM_MUST_FREE);
 		resp = MHD_create_response_from_buffer(replysz, reply, MHD_RESPMEM_MUST_FREE);
 		getwork_prepare_resp(resp);
 		getwork_prepare_resp(resp);
+		MHD_add_response_header(resp, "X-Mining-Identifier", cgpu->proc_repr);
 		ret = MHD_queue_response(conn, 200, resp);
 		ret = MHD_queue_response(conn, 200, resp);
 		MHD_destroy_response(resp);
 		MHD_destroy_response(resp);
 	}
 	}