Added extra error message.
This commit is contained in:
@ -466,11 +466,7 @@ bool xmrig::Client::send(BIO *bio)
|
|||||||
|
|
||||||
bool result = false;
|
bool result = false;
|
||||||
if (state() == ConnectedState && uv_is_writable(m_stream)) {
|
if (state() == ConnectedState && uv_is_writable(m_stream)) {
|
||||||
result = uv_try_write(m_stream, &buf, 1) > 0;
|
result = write(buf);
|
||||||
|
|
||||||
if (!result) {
|
|
||||||
close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LOG_DEBUG_ERR("[%s] send failed, invalid state: %d", url(), m_state);
|
LOG_DEBUG_ERR("[%s] send failed, invalid state: %d", url(), m_state);
|
||||||
@ -511,6 +507,23 @@ bool xmrig::Client::verifyAlgorithm(const Algorithm &algorithm, const char *algo
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool xmrig::Client::write(const uv_buf_t &buf)
|
||||||
|
{
|
||||||
|
const int rc = uv_try_write(m_stream, &buf, 1);
|
||||||
|
if (static_cast<size_t>(rc) == buf.len) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isQuiet()) {
|
||||||
|
LOG_ERR("[%s] write error: \"%s\"", url(), uv_strerror(rc));
|
||||||
|
}
|
||||||
|
|
||||||
|
close();
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int xmrig::Client::resolve(const String &host)
|
int xmrig::Client::resolve(const String &host)
|
||||||
{
|
{
|
||||||
setState(HostLookupState);
|
setState(HostLookupState);
|
||||||
@ -553,8 +566,7 @@ int64_t xmrig::Client::send(size_t size)
|
|||||||
|
|
||||||
uv_buf_t buf = uv_buf_init(m_sendBuf.data(), (unsigned int) size);
|
uv_buf_t buf = uv_buf_init(m_sendBuf.data(), (unsigned int) size);
|
||||||
|
|
||||||
if (uv_try_write(m_stream, &buf, 1) < 0) {
|
if (!write(buf)) {
|
||||||
close();
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,6 +96,7 @@ private:
|
|||||||
bool parseLogin(const rapidjson::Value &result, int *code);
|
bool parseLogin(const rapidjson::Value &result, int *code);
|
||||||
bool send(BIO *bio);
|
bool send(BIO *bio);
|
||||||
bool verifyAlgorithm(const Algorithm &algorithm, const char *algo) const;
|
bool verifyAlgorithm(const Algorithm &algorithm, const char *algo) const;
|
||||||
|
bool write(const uv_buf_t &buf);
|
||||||
int resolve(const String &host);
|
int resolve(const String &host);
|
||||||
int64_t send(size_t size);
|
int64_t send(size_t size);
|
||||||
void connect(sockaddr *addr);
|
void connect(sockaddr *addr);
|
||||||
|
Reference in New Issue
Block a user