mirror of https://github.com/GOSTSec/poolserver
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
722 B
40 lines
722 B
#ifndef SHARELIMITER_H_ |
|
#define SHARELIMITER_H_ |
|
|
|
#include "Common.h" |
|
#include "Util.h" |
|
|
|
#include <deque> |
|
|
|
namespace Stratum |
|
{ |
|
class Client; |
|
|
|
class ShareLimiter |
|
{ |
|
public: |
|
ShareLimiter(Client* client) : _client(client), _totalShares(0), _totalBadShares(0) |
|
{ |
|
_startTime = Util::Date(); |
|
_lastRetarget = _startTime; |
|
} |
|
|
|
bool Submit(); |
|
|
|
void LogBad() |
|
{ |
|
++_totalBadShares; |
|
} |
|
|
|
private: |
|
std::deque<uint64> _shares; |
|
Client* _client; |
|
uint64 _lastRetarget; |
|
uint64 _startTime; |
|
|
|
uint64 _totalShares; |
|
uint64 _totalBadShares; |
|
}; |
|
} |
|
|
|
#endif
|
|
|