This repository was archived by the owner on Apr 24, 2022. It is now read-only.
File tree 3 files changed +24
-19
lines changed
3 files changed +24
-19
lines changed Original file line number Diff line number Diff line change @@ -156,7 +156,24 @@ URI::URI(const std::string uri)
156
156
tmpstr++;
157
157
len = tmpstr - curstr;
158
158
m_username.append (curstr, len);
159
+
160
+ // Expect we got a uri "username%2e246891.rigname%2e01:x@eu-01.miningrigrentals.com:3344"
161
+ // which should mean: username = "username.246891"
162
+ // workername = "rigname.01"
163
+ // we must split username and workername before urlDecode() is called !
164
+ auto p = m_username.find_first_of (" ." );
165
+ if (p != std::string::npos)
166
+ {
167
+ // There should be at least one char after dot
168
+ // returned p is zero based
169
+ if (p < (m_username.length () - 1 ))
170
+ m_workername = m_username.substr (p+1 );
171
+
172
+ m_username = m_username.substr (0 , p);
173
+ }
159
174
m_username = urlDecode (m_username);
175
+ m_workername = urlDecode (m_workername);
176
+
160
177
// Look for password
161
178
curstr = tmpstr;
162
179
if (' :' == *curstr)
Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ class URI
58
58
unsigned short Port () const { return m_port; }
59
59
std::string User () const { return m_username; }
60
60
std::string Pass () const { return m_password; }
61
+ std::string Workername () const { return m_workername; }
61
62
SecureLevel SecLevel () const ;
62
63
ProtocolFamily Family () const ;
63
64
UriHostNameType HostNameType () const ;
@@ -88,6 +89,7 @@ class URI
88
89
std::string m_fragment;
89
90
std::string m_username;
90
91
std::string m_password;
92
+ std::string m_workername;
91
93
std::string m_uri;
92
94
unsigned short m_stratumMode = 999 ; // Initial value 999 means not tested yet
93
95
unsigned short m_port = 0 ;
Original file line number Diff line number Diff line change @@ -611,23 +611,9 @@ void EthStratumClient::connect_handler(const boost::system::error_code& ec)
611
611
m_sendBuffer.consume (4096 );
612
612
clear_response_pleas ();
613
613
614
- // Extract user and worker
615
- size_t p;
616
- m_worker.clear ();
617
- p = m_conn->User ().find_first_of (" ." );
618
- if (p != string::npos)
619
- {
620
- m_user = m_conn->User ().substr (0 , p);
621
-
622
- // There should be at least one char after dot
623
- // returned p is zero based
624
- if (p < (m_conn->User ().length () - 1 ))
625
- m_worker = m_conn->User ().substr (++p);
626
- }
627
- else
628
- {
629
- m_user = m_conn->User ();
630
- }
614
+ // user and worker
615
+ m_user = m_conn->User ();
616
+ m_worker = m_conn->Workername ();
631
617
632
618
/*
633
619
@@ -1430,7 +1416,7 @@ void EthStratumClient::onRecvSocketDataCompleted(
1430
1416
1431
1417
if (!ec && bytes_transferred > 0 )
1432
1418
{
1433
-
1419
+
1434
1420
// DO NOT DO THIS !!!!!
1435
1421
// std::istream is(&m_recvBuffer);
1436
1422
// std::string message;
@@ -1511,7 +1497,7 @@ void EthStratumClient::onRecvSocketDataCompleted(
1511
1497
}
1512
1498
}
1513
1499
1514
- void EthStratumClient::send (Json::Value const & jReq)
1500
+ void EthStratumClient::send (Json::Value const & jReq)
1515
1501
{
1516
1502
std::string* line = new std::string (Json::writeString (m_jSwBuilder, jReq));
1517
1503
m_txQueue.push (line);
You can’t perform that action at this time.
0 commit comments