summaryrefslogtreecommitdiffstats
path: root/src/OSSupport/UDPEndpointImpl.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2023-05-11 22:05:17 +0200
committerMattes D <github@xoft.cz>2023-05-16 23:50:37 +0200
commitc9522fb740200ccef6230cec452c48efb31e5394 (patch)
tree7e74d70699e13dd0a92444a1a0add7a3059ac7ca /src/OSSupport/UDPEndpointImpl.cpp
parentTry a timeout for jobs. (diff)
downloadcuberite-c9522fb740200ccef6230cec452c48efb31e5394.tar
cuberite-c9522fb740200ccef6230cec452c48efb31e5394.tar.gz
cuberite-c9522fb740200ccef6230cec452c48efb31e5394.tar.bz2
cuberite-c9522fb740200ccef6230cec452c48efb31e5394.tar.lz
cuberite-c9522fb740200ccef6230cec452c48efb31e5394.tar.xz
cuberite-c9522fb740200ccef6230cec452c48efb31e5394.tar.zst
cuberite-c9522fb740200ccef6230cec452c48efb31e5394.zip
Diffstat (limited to '')
-rw-r--r--src/OSSupport/UDPEndpointImpl.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/OSSupport/UDPEndpointImpl.cpp b/src/OSSupport/UDPEndpointImpl.cpp
index 3f04dd4f5..2550c5378 100644
--- a/src/OSSupport/UDPEndpointImpl.cpp
+++ b/src/OSSupport/UDPEndpointImpl.cpp
@@ -392,7 +392,9 @@ void cUDPEndpointImpl::Open(UInt16 a_Port)
if (!UDPEndpointImplHelper::IsValidSocket(m_MainSock))
{
err = EVUTIL_SOCKET_ERROR();
- m_Callbacks.OnError(err, Printf("Cannot create UDP socket for port %d: %s", a_Port, evutil_socket_error_to_string(err)));
+ m_Callbacks.OnError(err, fmt::format(FMT_STRING("Cannot create UDP socket for port {}: {} ({})"),
+ a_Port, err, evutil_socket_error_to_string(err))
+ );
return;
}
@@ -413,7 +415,9 @@ void cUDPEndpointImpl::Open(UInt16 a_Port)
if (bind(m_MainSock, reinterpret_cast<const sockaddr *>(&name), sizeof(name)) != 0)
{
err = EVUTIL_SOCKET_ERROR();
- m_Callbacks.OnError(err, Printf("Cannot bind UDP port %d: %s", a_Port, evutil_socket_error_to_string(err)));
+ m_Callbacks.OnError(err, fmt::format(FMT_STRING("Cannot bind UDP port {}: {} ({})"),
+ a_Port, err, evutil_socket_error_to_string(err))
+ );
evutil_closesocket(m_MainSock);
return;
}
@@ -448,7 +452,9 @@ void cUDPEndpointImpl::Open(UInt16 a_Port)
if (bind(m_MainSock, reinterpret_cast<const sockaddr *>(&name), sizeof(name)) != 0)
{
err = EVUTIL_SOCKET_ERROR();
- m_Callbacks.OnError(err, Printf("Cannot bind to UDP port %d: %s", a_Port, evutil_socket_error_to_string(err)));
+ m_Callbacks.OnError(err, fmt::format(FMT_STRING("Cannot bind to UDP port {}: {} ({})"),
+ a_Port, err, evutil_socket_error_to_string(err))
+ );
evutil_closesocket(m_MainSock);
return;
}
@@ -456,7 +462,9 @@ void cUDPEndpointImpl::Open(UInt16 a_Port)
if (evutil_make_socket_nonblocking(m_MainSock) != 0)
{
err = EVUTIL_SOCKET_ERROR();
- m_Callbacks.OnError(err, Printf("Cannot make socket on UDP port %d nonblocking: %s", a_Port, evutil_socket_error_to_string(err)));
+ m_Callbacks.OnError(err, fmt::format(FMT_STRING("Cannot make socket on UDP port {} nonblocking: {} ({})"),
+ a_Port, err, evutil_socket_error_to_string(err))
+ );
evutil_closesocket(m_MainSock);
return;
}