use original formatting

This commit is contained in:
Proddy
2023-07-15 11:34:57 +02:00
parent cbecebd80a
commit b659218d13

View File

@@ -13,8 +13,8 @@ the LICENSE file.
namespace espMqttClientInternals { namespace espMqttClientInternals {
ClientPosix::ClientPosix() ClientPosix::ClientPosix()
: _sockfd(-1) : _sockfd(-1)
, _host() { , _host() {
// empty // empty
} }
@@ -23,8 +23,7 @@ ClientPosix::~ClientPosix() {
} }
bool ClientPosix::connect(IPAddress ip, uint16_t port) { bool ClientPosix::connect(IPAddress ip, uint16_t port) {
if (connected()) if (connected()) stop();
stop();
_sockfd = ::socket(AF_INET, SOCK_STREAM, 0); _sockfd = ::socket(AF_INET, SOCK_STREAM, 0);
if (_sockfd < 0) { if (_sockfd < 0) {
@@ -39,7 +38,7 @@ bool ClientPosix::connect(IPAddress ip, uint16_t port) {
memset(&_host, 0, sizeof(_host)); memset(&_host, 0, sizeof(_host));
_host.sin_family = AF_INET; _host.sin_family = AF_INET;
_host.sin_addr.s_addr = htonl(uint32_t(ip)); _host.sin_addr.s_addr = htonl(uint32_t(ip));
_host.sin_port = htons(port); _host.sin_port = ::htons(port);
int ret = ::connect(_sockfd, (struct sockaddr *)&_host, sizeof(_host)); int ret = ::connect(_sockfd, (struct sockaddr *)&_host, sizeof(_host));
@@ -52,18 +51,18 @@ bool ClientPosix::connect(IPAddress ip, uint16_t port) {
return true; return true;
} }
bool ClientPosix::connect(const char * host, uint16_t port) { bool ClientPosix::connect(const char* host, uint16_t port) {
// tbi // tbi
(void)host; (void) host;
(void)port; (void) port;
return false; return false;
} }
size_t ClientPosix::write(const uint8_t * buf, size_t size) { size_t ClientPosix::write(const uint8_t* buf, size_t size) {
return ::send(_sockfd, buf, size, 0); return ::send(_sockfd, buf, size, 0);
} }
int ClientPosix::read(uint8_t * buf, size_t size) { int ClientPosix::read(uint8_t* buf, size_t size) {
int ret = ::recv(_sockfd, buf, size, MSG_DONTWAIT); int ret = ::recv(_sockfd, buf, size, MSG_DONTWAIT);
/* /*
if (ret < 0) { if (ret < 0) {