Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion system/jlib/jsocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ static RelaxedAtomic<unsigned> pre_conn_unreach_cnt{0}; // global count of pr

#define IPV6_SERIALIZE_PREFIX (0x00ff00ff)


class jlib_thrown_decl SocketException: public IJSOCK_Exception, public CInterface
{
public:
Expand Down Expand Up @@ -290,6 +289,11 @@ class jlib_thrown_decl SocketException: public IJSOCK_Exception, public CInterfa
char *msg;
};

void getSocketErrorMessage(StringBuffer & str, int err)
{
SocketException::geterrormessage(err, str);
}

IJSOCK_Exception* createJSocketException(int jsockErr, const char *_msg, const char *file, unsigned line)
{
StringBuffer msg;
Expand Down
2 changes: 1 addition & 1 deletion system/jlib/jsocket.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ class jlib_decl CSingletonSocketConnection: implements IConversation, public CIn
};

extern jlib_decl void shutdownAndCloseNoThrow(ISocket * optSocket); // Safely shutdown and close a socket without throwing an exception.

extern jlib_decl void getSocketErrorMessage(StringBuffer & str, int err);

#ifdef _WIN32
#define SOCKETERRNO() WSAGetLastError()
Expand Down
6 changes: 6 additions & 0 deletions system/security/securesocket/socketutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,12 @@ void CSocketTarget::onAsyncComplete(int result)
case State::Reconnecting:
if (result < 0)
{
StringBuffer epText, cause;
const char * stateText = (state == State::Connecting) ? "connect" : "reconnect";
ep.getEndpointHostText(epText);
getSocketErrorMessage(cause, -result);
OERRLOG("Failed to %s to %s: %s", stateText, epText.str(), cause.str());

// Connection failed - clean up socket
socket.clear();

Expand Down
Loading