mirror of
https://github.com/yse/easy_profiler.git
synced 2024-12-26 16:11:02 +08:00
Recreate socket on failed connection #154
This commit is contained in:
parent
0ccb564099
commit
3be797b4ad
@ -123,8 +123,10 @@ void EasySocket::flush()
|
||||
if (m_socket)
|
||||
closeSocket(m_socket);
|
||||
|
||||
if (m_replySocket != m_socket)
|
||||
if (m_replySocket != m_socket && m_replySocket != 0) {
|
||||
// we do not need to close uninitialized reply socket
|
||||
closeSocket(m_replySocket);
|
||||
}
|
||||
|
||||
#if defined(_WIN32)
|
||||
m_socket = 0;
|
||||
@ -157,6 +159,9 @@ void EasySocket::checkResult(int result)
|
||||
#if !defined(_WIN32)
|
||||
case SOCK_BROKEN_PIPE:
|
||||
case SOCK_ENOENT:
|
||||
#endif
|
||||
#if defined (__APPLE__)
|
||||
case ECONNREFUSED:
|
||||
#endif
|
||||
m_state = ConnectionState::Disconnected;
|
||||
break;
|
||||
|
@ -2536,11 +2536,9 @@ void MainWindow::onConnectClicked(bool)
|
||||
if (!m_listener.connect(address.toStdString().c_str(), port, reply))
|
||||
{
|
||||
Dialog::warning(this, "Warning", QString("Cannot connect to %1").arg(address), QMessageBox::Close);
|
||||
if (EASY_GLOBALS.connected)
|
||||
{
|
||||
// we need to close socket everytime on failed connection
|
||||
m_listener.closeSocket();
|
||||
setDisconnected(false);
|
||||
}
|
||||
|
||||
if (!isSameAddress)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user