@@ -31,7 +31,11 @@ class EthStratumClient : public PoolClient
31
31
void disconnect ();
32
32
33
33
// Connected and Connection Statuses
34
- bool isConnected () { return m_connected.load (std::memory_order_relaxed); }
34
+ bool isConnected ()
35
+ {
36
+ return m_connected.load (std::memory_order_relaxed) &&
37
+ !m_disconnecting.load (std::memory_order_relaxed);
38
+ }
35
39
bool isSubscribed () { return m_subscribed.load (std::memory_order_relaxed); }
36
40
bool isAuthorized () { return m_authorized.load (std::memory_order_relaxed); }
37
41
string ActiveEndPoint () { return " [" + toString (m_endpoint) + " ]" ; };
@@ -57,19 +61,25 @@ class EthStratumClient : public PoolClient
57
61
58
62
void recvSocketData ();
59
63
void onRecvSocketDataCompleted (const boost::system::error_code& ec, std::size_t bytes_transferred);
60
- void sendSocketData (string const & data );
64
+ void sendSocketData (Json::Value const & jReq );
61
65
void onSendSocketDataCompleted (const boost::system::error_code& ec);
62
66
63
67
64
- string m_worker; // eth-proxy only;
68
+ string m_worker; // eth-proxy only; No ! It's for all !!!
65
69
66
70
std::atomic<bool > m_subscribed = { false };
67
71
std::atomic<bool > m_authorized = { false };
68
72
std::atomic<bool > m_connected = { false };
69
73
std::atomic<bool > m_disconnecting = { false };
70
74
71
- int m_worktimeout = 60 ;
75
+ // Fixed 120 seconds to trigger a work_timeout
76
+ int m_worktimeout = 120 ;
72
77
78
+ // Fixed 2 seconds timeout for a response to a submission of solution
79
+ int m_responsetimeout = 2 ;
80
+
81
+ // Fixed 3 seconds timeout for a connection attempt
82
+ int m_conntimeout = 3 ;
73
83
74
84
WorkPackage m_current;
75
85
@@ -88,6 +98,7 @@ class EthStratumClient : public PoolClient
88
98
89
99
boost::asio::streambuf m_sendBuffer;
90
100
boost::asio::streambuf m_recvBuffer;
101
+ Json::FastWriter m_jWriter;
91
102
int m_recvBufferSize = 1024 ;
92
103
93
104
boost::asio::deadline_timer m_conntimer;
0 commit comments