patch3.patch 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. From d9d6de68ba7ce8a9662bc143382575f7147fb08c Mon Sep 17 00:00:00 2001
  2. From: nicehashdev <info@nicehash.com>
  3. Date: Thu, 6 Aug 2015 11:57:09 +0200
  4. Subject: [PATCH] xn subscribe fixes
  5. - xn subscribe at one place now only
  6. ---
  7. cgminer.c | 2 +-
  8. util.c | 15 ++++++++++++---
  9. util.h | 2 +-
  10. 3 files changed, 14 insertions(+), 5 deletions(-)
  11. diff --git a/cgminer.c b/cgminer.c
  12. index 91038f1f27..48540352ea 100644
  13. --- a/cgminer.c
  14. +++ b/cgminer.c
  15. @@ -6456,7 +6456,7 @@ static bool pool_active(struct pool *pool, bool pinging)
  16. if (!init) {
  17. bool ret = initiate_stratum(pool) && auth_stratum(pool);
  18. - extranonce_subscribe_stratum(pool);
  19. + //extranonce_subscribe_stratum(pool);
  20. if (ret)
  21. init_stratum_threads(pool);
  22. else
  23. diff --git a/util.c b/util.c
  24. index 795c6bd622..a021b8db54 100644
  25. --- a/util.c
  26. +++ b/util.c
  27. @@ -2858,7 +2858,7 @@ void suspend_stratum(struct pool *pool)
  28. mutex_unlock(&pool->stratum_lock);
  29. }
  30. -void extranonce_subscribe_stratum(struct pool *pool)
  31. +/*void extranonce_subscribe_stratum(struct pool *pool)
  32. {
  33. char s[RBUFSIZE];
  34. if(pool->extranonce_subscribe)
  35. @@ -2867,7 +2867,7 @@ void extranonce_subscribe_stratum(struct pool *pool)
  36. applog(LOG_INFO, "Send extranonce.subscribe for stratum pool %d", pool->pool_no);
  37. stratum_send(pool, s, strlen(s));
  38. }
  39. -}
  40. +}*/
  41. bool initiate_stratum(struct pool *pool)
  42. {
  43. @@ -2901,6 +2901,15 @@ bool initiate_stratum(struct pool *pool)
  44. goto out;
  45. }
  46. + if (pool->extranonce_subscribe)
  47. + {
  48. + sprintf(s, "{\"id\": %d, \"method\": \"mining.extranonce.subscribe\", \"params\": []}", swork_id++);
  49. + if (__stratum_send(pool, s, strlen(s)) != SEND_OK) {
  50. + applog(LOG_DEBUG, "Failed to send s in initiate_stratum");
  51. + goto out;
  52. + }
  53. + }
  54. +
  55. if (!socket_full(pool, DEFAULT_SOCKWAIT)) {
  56. applog(LOG_DEBUG, "Timed out waiting for response in initiate_stratum");
  57. goto out;
  58. @@ -3019,7 +3028,7 @@ bool restart_stratum(struct pool *pool)
  59. goto out;
  60. if (!auth_stratum(pool))
  61. goto out;
  62. - extranonce_subscribe_stratum(pool);
  63. + //extranonce_subscribe_stratum(pool);
  64. ret = true;
  65. out:
  66. if (!ret)
  67. diff --git a/util.h b/util.h
  68. index eefa0f57d4..ae01203f34 100644
  69. --- a/util.h
  70. +++ b/util.h
  71. @@ -153,7 +153,7 @@ char *recv_line(struct pool *pool);
  72. bool parse_method(struct pool *pool, char *s);
  73. void check_extranonce_option(struct pool *pool, char * url);
  74. bool extract_sockaddr(char *url, char **sockaddr_url, char **sockaddr_port);
  75. -void extranonce_subscribe_stratum(struct pool *pool);
  76. +//void extranonce_subscribe_stratum(struct pool *pool);
  77. bool auth_stratum(struct pool *pool);
  78. bool initiate_stratum(struct pool *pool);
  79. bool restart_stratum(struct pool *pool);