mirror of
https://github.com/esphome/esphome.git
synced 2025-11-19 16:25:50 +00:00
Merge branch 'frame_helper_socket_dupe' into integration
This commit is contained in:
@@ -84,9 +84,7 @@ class APIFrameHelper {
|
|||||||
public:
|
public:
|
||||||
APIFrameHelper() = default;
|
APIFrameHelper() = default;
|
||||||
explicit APIFrameHelper(std::unique_ptr<socket::Socket> socket, const ClientInfo *client_info)
|
explicit APIFrameHelper(std::unique_ptr<socket::Socket> socket, const ClientInfo *client_info)
|
||||||
: socket_owned_(std::move(socket)), client_info_(client_info) {
|
: socket_(std::move(socket)), client_info_(client_info) {}
|
||||||
socket_ = socket_owned_.get();
|
|
||||||
}
|
|
||||||
virtual ~APIFrameHelper() = default;
|
virtual ~APIFrameHelper() = default;
|
||||||
virtual APIError init() = 0;
|
virtual APIError init() = 0;
|
||||||
virtual APIError loop();
|
virtual APIError loop();
|
||||||
@@ -149,9 +147,8 @@ class APIFrameHelper {
|
|||||||
APIError write_raw_(const struct iovec *iov, int iovcnt, socket::Socket *socket, std::vector<uint8_t> &tx_buf,
|
APIError write_raw_(const struct iovec *iov, int iovcnt, socket::Socket *socket, std::vector<uint8_t> &tx_buf,
|
||||||
const std::string &info, StateEnum &state, StateEnum failed_state);
|
const std::string &info, StateEnum &state, StateEnum failed_state);
|
||||||
|
|
||||||
// Pointers first (4 bytes each)
|
// Socket ownership (4 bytes on 32-bit, 8 bytes on 64-bit)
|
||||||
socket::Socket *socket_{nullptr};
|
std::unique_ptr<socket::Socket> socket_;
|
||||||
std::unique_ptr<socket::Socket> socket_owned_;
|
|
||||||
|
|
||||||
// Common state enum for all frame helpers
|
// Common state enum for all frame helpers
|
||||||
// Note: Not all states are used by all implementations
|
// Note: Not all states are used by all implementations
|
||||||
|
|||||||
Reference in New Issue
Block a user