diff options
| author | auth <[email protected]> | 2020-07-05 12:00:04 +0200 |
|---|---|---|
| committer | auth <[email protected]> | 2020-07-05 12:00:04 +0200 |
| commit | 6a33a72c7b423afb143a67a3e88d27e4bcafd116 (patch) | |
| tree | 93766d360a2eb76ec35362bb2645910f7297a742 /server/src/client | |
| parent | Merge branch 'master' of github.com:auth12/loader (diff) | |
| download | loader-6a33a72c7b423afb143a67a3e88d27e4bcafd116.tar.xz loader-6a33a72c7b423afb143a67a3e88d27e4bcafd116.zip | |
More assembler implementations.
Small changes to client on server.
Diffstat (limited to 'server/src/client')
| -rw-r--r-- | server/src/client/client.h | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/server/src/client/client.h b/server/src/client/client.h index 4dad02e..141ac67 100644 --- a/server/src/client/client.h +++ b/server/src/client/client.h @@ -15,7 +15,6 @@ class client { public: std::string hwid; - client() : m_socket{-1} {}; client(const int& socket, const std::string_view ip) : m_socket{std::move(socket)}, m_ip{ip}, m_ssl{nullptr} {} @@ -27,6 +26,8 @@ class client { close(m_socket); SSL_shutdown(m_ssl); SSL_free(m_ssl); + + m_socket = -1; } void reset() { std::time(&m_time); } @@ -46,12 +47,12 @@ class client { int stream(std::vector<char>& data, float* dur = nullptr); int read_stream(std::vector<char>& out); - int stream(std::string &str) { + int stream(std::string& str) { std::vector<char> vec(str.begin(), str.end()); return stream(vec); } - int read_stream(std::string &str) { + int read_stream(std::string& str) { std::vector<char> out; int ret = read_stream(out); str.assign(out.begin(), out.end()); @@ -60,8 +61,10 @@ class client { void gen_session(); - int &get_socket() { return m_socket; } - auto &get_ip() { return m_ip; } - auto &get_session() { return m_session_id; } + int& get_socket() { return m_socket; } + auto& get_ip() { return m_ip; } + auto& get_session() { return m_session_id; } + + operator bool() const { return m_ssl && m_socket > 0; } }; }; // namespace tcp
\ No newline at end of file |