qb  2.0.0.0
C++17 Actor Framework
qb Issue Watch Star Fork Follow @isndev
Loading...
Searching...
No Matches
stcp.h
Go to the documentation of this file.
1
25
26#ifndef QB_IO_TRANSPORT_STCP_H
27#define QB_IO_TRANSPORT_STCP_H
28#include <iostream>
29#include "../stream.h"
30#include "../tcp/ssl/socket.h"
31namespace qb::io::transport {
32
44class stcp : public stream<io::tcp::ssl::socket> {
45public:
47 constexpr bool is_secure() const noexcept { return true; }
57 [[nodiscard]] int
58 read() noexcept {
59 static constexpr const std::size_t bucket_read = 8192;
60
61 auto ret = _in.read(_in_buffer.allocate_back(bucket_read), bucket_read);
62 if (ret >= 0) {
63 _in_buffer.free_back(bucket_read - ret);
64 const auto pending = SSL_pending(transport().ssl_handle());
65 if (pending) {
66 ret += _in.read(_in_buffer.allocate_back(pending), pending);
67 }
68 }
69 return ret;
70 }
71};
72
73} // namespace qb::io::transport
74
75#endif // QB_IO_TRANSPORT_STCP_H
input_buffer_type _in_buffer
Definition stream.h:59
io::tcp::ssl::socket _in
Definition stream.h:58
io::tcp::ssl::socket & transport() noexcept
Definition stream.h:76
Combined input/output stream template class.
Definition stream.h:303
Secure TCP (SSL/TLS) transport providing encrypted stream communication.
Definition stcp.h:44
constexpr bool is_secure() const noexcept
Indicates that this transport implementation is secure.
Definition stcp.h:47
int read() noexcept
Read data from the secure TCP socket.
Definition stcp.h:58
Core stream abstraction classes for the QB IO library.
Implementation of SSL/TLS sockets for secure TCP communication in the QB IO library.