mirror of
https://github.com/xmrig/xmrig.git
synced 2025-02-02 11:16:37 +00:00
Revert changes in Api class, single threaded http server will not be included in 2.5 release.
This commit is contained in:
parent
3e2863dca5
commit
b662cb77a4
2 changed files with 14 additions and 3 deletions
|
@ -4,7 +4,7 @@
|
|||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2016-2018 XMRig <support@xmrig.com>
|
||||
* Copyright 2016-2017 XMRig <support@xmrig.com>
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
@ -29,10 +29,12 @@
|
|||
|
||||
|
||||
ApiState *Api::m_state = nullptr;
|
||||
uv_mutex_t Api::m_mutex;
|
||||
|
||||
|
||||
bool Api::start()
|
||||
{
|
||||
uv_mutex_init(&m_mutex);
|
||||
m_state = new ApiState();
|
||||
|
||||
return true;
|
||||
|
@ -51,7 +53,11 @@ char *Api::get(const char *url, int *status)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
return m_state->get(url, status);
|
||||
uv_mutex_lock(&m_mutex);
|
||||
char *buf = m_state->get(url, status);
|
||||
uv_mutex_unlock(&m_mutex);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
|
@ -61,7 +67,9 @@ void Api::tick(const Hashrate *hashrate)
|
|||
return;
|
||||
}
|
||||
|
||||
uv_mutex_lock(&m_mutex);
|
||||
m_state->tick(hashrate);
|
||||
uv_mutex_unlock(&m_mutex);
|
||||
}
|
||||
|
||||
|
||||
|
@ -71,5 +79,7 @@ void Api::tick(const NetworkState &network)
|
|||
return;
|
||||
}
|
||||
|
||||
uv_mutex_lock(&m_mutex);
|
||||
m_state->tick(network);
|
||||
uv_mutex_unlock(&m_mutex);
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
|
||||
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
|
||||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2016-2018 XMRig <support@xmrig.com>
|
||||
* Copyright 2016-2017 XMRig <support@xmrig.com>
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
@ -45,6 +45,7 @@ public:
|
|||
|
||||
private:
|
||||
static ApiState *m_state;
|
||||
static uv_mutex_t m_mutex;
|
||||
};
|
||||
|
||||
#endif /* __API_H__ */
|
||||
|
|
Loading…
Reference in a new issue