mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
Change epee binary output from std::stringstream to byte_stream
This commit is contained in:
parent
a3033e741b
commit
0b8bf308ce
23 changed files with 126 additions and 106 deletions
|
@ -26,6 +26,7 @@
|
|||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include <boost/utility/string_ref.hpp>
|
||||
#include "include_base_utils.h"
|
||||
#include "file_io_utils.h"
|
||||
#include "net/http_client.h"
|
||||
|
@ -38,7 +39,7 @@ public:
|
|||
bool connect(const std::string& addr, int port, std::chrono::milliseconds timeout, bool ssl = false, const std::string& bind_ip = "0.0.0.0") { return true; }
|
||||
bool connect(const std::string& addr, const std::string& port, std::chrono::milliseconds timeout, bool ssl = false, const std::string& bind_ip = "0.0.0.0") { return true; }
|
||||
bool disconnect() { return true; }
|
||||
bool send(const std::string& buff, std::chrono::milliseconds timeout) { return true; }
|
||||
bool send(const boost::string_ref buff, std::chrono::milliseconds timeout) { return true; }
|
||||
bool send(const void* data, size_t sz) { return true; }
|
||||
bool is_connected() { return true; }
|
||||
bool recv(std::string& buff, std::chrono::milliseconds timeout)
|
||||
|
|
|
@ -65,13 +65,13 @@ namespace
|
|||
{
|
||||
}
|
||||
|
||||
virtual int invoke(int command, const epee::span<const uint8_t> in_buff, std::string& buff_out, test_levin_connection_context& context)
|
||||
virtual int invoke(int command, const epee::span<const uint8_t> in_buff, epee::byte_slice& buff_out, test_levin_connection_context& context)
|
||||
{
|
||||
m_invoke_counter.inc();
|
||||
boost::unique_lock<boost::mutex> lock(m_mutex);
|
||||
m_last_command = command;
|
||||
m_last_in_buf = std::string((const char*)in_buff.data(), in_buff.size());
|
||||
buff_out = m_invoke_out_buf;
|
||||
buff_out = m_invoke_out_buf.clone();
|
||||
return m_return_code;
|
||||
}
|
||||
|
||||
|
@ -111,8 +111,7 @@ namespace
|
|||
int return_code() const { return m_return_code; }
|
||||
void return_code(int v) { m_return_code = v; }
|
||||
|
||||
const std::string& invoke_out_buf() const { return m_invoke_out_buf; }
|
||||
void invoke_out_buf(const std::string& v) { m_invoke_out_buf = v; }
|
||||
void invoke_out_buf(std::string v) { m_invoke_out_buf = epee::byte_slice{std::move(v)}; }
|
||||
|
||||
int last_command() const { return m_last_command; }
|
||||
const std::string& last_in_buf() const { return m_last_in_buf; }
|
||||
|
@ -127,7 +126,7 @@ namespace
|
|||
boost::mutex m_mutex;
|
||||
|
||||
int m_return_code;
|
||||
std::string m_invoke_out_buf;
|
||||
epee::byte_slice m_invoke_out_buf;
|
||||
|
||||
int m_last_command;
|
||||
std::string m_last_in_buf;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue