Re-enabled logging in socket.

This commit is contained in:
Relintai 2022-02-10 11:10:45 +01:00
parent 15f1f810be
commit b9d441bf60

View File

@ -31,6 +31,7 @@
#include "socket.h" #include "socket.h"
#include <assert.h> #include <assert.h>
#include <sys/types.h> #include <sys/types.h>
#include "core/log/logger.h"
#ifdef _WIN32 #ifdef _WIN32
#include <ws2tcpip.h> #include <ws2tcpip.h>
#else #else
@ -71,7 +72,7 @@ void Socket::bindAddress(const InetAddress &localaddr) {
if (ret == 0) if (ret == 0)
return; return;
else { else {
//LOG_SYSERR << ", Bind address failed at " << localaddr.toIpPort(); LOG_SYSERR << ", Bind address failed at " << localaddr.toIpPort();
exit(1); exit(1);
} }
} }
@ -79,7 +80,7 @@ void Socket::listen() {
assert(sockFd_ > 0); assert(sockFd_ > 0);
int ret = ::listen(sockFd_, SOMAXCONN); int ret = ::listen(sockFd_, SOMAXCONN);
if (ret < 0) { if (ret < 0) {
//LOG_SYSERR << "listen failed"; LOG_SYSERR << "listen failed";
exit(1); exit(1);
} }
} }
@ -109,7 +110,7 @@ void Socket::closeWrite() {
if (::shutdown(sockFd_, SD_SEND) < 0) if (::shutdown(sockFd_, SD_SEND) < 0)
#endif #endif
{ {
//LOG_SYSERR << "sockets::shutdownWrite"; LOG_SYSERR << "sockets::shutdownWrite";
} }
} }
int Socket::read(char *buffer, uint64_t len) { int Socket::read(char *buffer, uint64_t len) {
@ -127,7 +128,7 @@ struct sockaddr_in6 Socket::getLocalAddr(int sockfd) {
if (::getsockname(sockfd, if (::getsockname(sockfd,
static_cast<struct sockaddr *>((void *)(&localaddr)), static_cast<struct sockaddr *>((void *)(&localaddr)),
&addrlen) < 0) { &addrlen) < 0) {
//LOG_SYSERR << "sockets::getLocalAddr"; LOG_SYSERR << "sockets::getLocalAddr";
} }
return localaddr; return localaddr;
} }
@ -139,7 +140,7 @@ struct sockaddr_in6 Socket::getPeerAddr(int sockfd) {
if (::getpeername(sockfd, if (::getpeername(sockfd,
static_cast<struct sockaddr *>((void *)(&peeraddr)), static_cast<struct sockaddr *>((void *)(&peeraddr)),
&addrlen) < 0) { &addrlen) < 0) {
//LOG_SYSERR << "sockets::getPeerAddr"; LOG_SYSERR << "sockets::getPeerAddr";
} }
return peeraddr; return peeraddr;
} }
@ -185,7 +186,7 @@ void Socket::setReusePort(bool on) {
&optval, &optval,
static_cast<socklen_t>(sizeof optval)); static_cast<socklen_t>(sizeof optval));
if (ret < 0 && on) { if (ret < 0 && on) {
//LOG_SYSERR << "SO_REUSEPORT failed."; LOG_SYSERR << "SO_REUSEPORT failed.";
} }
#else #else
if (on) { if (on) {