Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Daemon support #264

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/api/NetworkState.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class NetworkState

char pool[256];
std::array<uint64_t, 10> topDiff { { } };
uint32_t diff;
uint64_t diff;
uint64_t accepted;
uint64_t failures;
uint64_t rejected;
Expand Down
19 changes: 15 additions & 4 deletions src/base/net/Pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Copyright 2016 Jay D Dee <[email protected]>
* Copyright 2017-2019 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2019 Howard Chu <https://github.com/hyc>
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -65,6 +66,7 @@ xmrig::Pool::Pool() :
m_enabled(true),
m_nicehash(false),
m_tls(false),
m_daemon(false),
m_keepAlive(0),
m_port(kDefaultPort)
{
Expand All @@ -86,6 +88,7 @@ xmrig::Pool::Pool(const char *url) :
m_enabled(true),
m_nicehash(false),
m_tls(false),
m_daemon(false),
m_keepAlive(0),
m_port(kDefaultPort)
{
Expand Down Expand Up @@ -135,6 +138,7 @@ xmrig::Pool::Pool(const char *host, uint16_t port, const char *user, const char
m_enabled(true),
m_nicehash(nicehash),
m_tls(tls),
m_daemon(false),
m_keepAlive(keepAlive),
m_host(host),
m_password(password),
Expand Down Expand Up @@ -210,17 +214,24 @@ bool xmrig::Pool::parse(const char *url)
const char *base = url;

if (p) {
if (strncasecmp(url, "stratum+tcp://", 14) == 0) {
m_tls = false;
if (strncasecmp(url, "stratum+", 8) == 0) {
if (p-url != 11)
return false;
} else if (strncasecmp(url, "daemon+",7) == 0) {
if (p-url != 10)
return false;
m_daemon = true;
}
else if (strncasecmp(url, "stratum+ssl://", 14) == 0) {
if (strncasecmp(p-3, "tcp:", 4) == 0) {
m_tls = false;
} else if (strncasecmp(p-3, "ssl:", 4) == 0) {
m_tls = true;
}
else {
return false;
}

base = url + 14;
base = p+3;
}

if (!strlen(base) || *base == '/') {
Expand Down
3 changes: 3 additions & 0 deletions src/base/net/Pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Copyright 2016 Jay D Dee <[email protected]>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2019 Howard Chu <https://github.com/hyc>
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -60,6 +61,7 @@ class Pool
inline bool isNicehash() const { return m_nicehash; }
inline bool isTLS() const { return m_tls; }
inline bool isValid() const { return !m_host.isNull() && m_port > 0; }
inline bool isDaemon() const { return m_daemon; }
inline const char *fingerprint() const { return m_fingerprint.data(); }
inline const char *host() const { return m_host.data(); }
inline const char *password() const { return !m_password.isNull() ? m_password.data() : kDefaultPassword; }
Expand Down Expand Up @@ -107,6 +109,7 @@ class Pool
bool m_enabled;
bool m_nicehash;
bool m_tls;
bool m_daemon;
int m_keepAlive;
String m_fingerprint;
String m_host;
Expand Down
Loading