Remove is_init() check on each log call

This commit is contained in:
Chris Love 2021-09-04 19:29:56 -07:00
parent 497fa60f57
commit 2e66a27081
3 changed files with 5 additions and 16 deletions

View File

@ -77,11 +77,6 @@ public:
init_winsock_();
}
if (is_init())
{
close();
}
addr_.sin_family = PF_INET;
addr_.sin_port = htons(port);
addr_.sin_addr.s_addr = INADDR_ANY;
@ -107,8 +102,11 @@ public:
}
void close()
{
if (socket_ != -1)
{
::closesocket(socket_);
}
socket_ = INVALID_SOCKET;
WSACleanup();
}

View File

@ -52,14 +52,9 @@ public:
return true;
}
bool is_init() const
{
return socket_ != -1;
}
void close()
{
if (is_init())
if (socket_ != -1)
{
::close(socket_);
socket_ = -1;

View File

@ -53,10 +53,6 @@ protected:
{
spdlog::memory_buf_t formatted;
spdlog::sinks::base_sink<Mutex>::formatter_->format(msg, formatted);
if (!client_.is_init())
{
client_.init(config_.server_host, config_.server_port);
}
client_.send(formatted.data(), formatted.size());
}