diff --git a/net/kernel_socket.cpp b/net/kernel_socket.cpp index 21ce9a8d..49a2a051 100644 --- a/net/kernel_socket.cpp +++ b/net/kernel_socket.cpp @@ -908,7 +908,8 @@ class ETKernelSocketStream : public KernelSocketStream, public NotifyContext { if (fd >= 0) etpoller.register_notifier(fd, this); } - ETKernelSocketStream() : KernelSocketStream(AF_INET, true) { + ETKernelSocketStream(int socket_family, bool nonblocking) : + KernelSocketStream(socket_family, nonblocking) { if (fd >= 0) etpoller.register_notifier(fd, this); } @@ -955,7 +956,7 @@ class ETKernelSocketClient : public KernelSocketClient { protected: KernelSocketStream* create_stream() override { - return new ETKernelSocketStream(); + return new ETKernelSocketStream(m_socket_family, m_nonblocking); } }; @@ -990,7 +991,7 @@ class ETKernelSocketServer : public KernelSocketServer, public NotifyContext { LogBuffer& operator<<(LogBuffer& log, const IPAddr addr) { if (addr.is_ipv4()) - return log.printf(addr.u8_1, '.', addr.u8_2, '.', addr.u8_3, '.', addr.u8_4); + return log.printf(addr.a, '.', addr.b, '.', addr.c, '.', addr.d); else { return log.printf(addr.to_string()); } diff --git a/net/socket.h b/net/socket.h index 8635c93a..6ff69d99 100644 --- a/net/socket.h +++ b/net/socket.h @@ -48,8 +48,7 @@ namespace net public: union { in6_addr addr = {}; - struct { uint16_t _1, _2, _3, _4, _5, _6; uint8_t u8_1, u8_2, u8_3, u8_4; }; - struct { uint16_t u16_1, u16_2, u16_3, u16_4, u16_5, u16_6, u16_7, u16_8; }; + struct { uint16_t _1, _2, _3, _4, _5, _6; uint8_t a, b, c, d; }; }; // For compatibility, the default constructor is still 0.0.0.0 (IPv4)