File tree Expand file tree Collapse file tree 1 file changed +14
-13
lines changed Expand file tree Collapse file tree 1 file changed +14
-13
lines changed Original file line number Diff line number Diff line change 7
7
#include " ../main/WebServerHelper.h"
8
8
#include " ../webserver/proxyclient.h"
9
9
10
+ #ifdef WIN32
11
+ #define SHUT_RDWR SD_BOTH
12
+ #endif
13
+
10
14
#define RETRY_DELAY 30
11
15
12
16
extern http::server::CWebServerHelper m_webservers;
@@ -147,20 +151,18 @@ bool DomoticzTCP::StopHardwareTCP()
147
151
// Don't throw from a Stop command
148
152
}
149
153
}
150
- else {
151
- try {
152
- if (m_thread)
153
- {
154
- m_stoprequested = true ;
155
- m_thread->join ();
156
- m_thread.reset ();
157
- }
158
- }
159
- catch (...)
154
+ try {
155
+ if (m_thread)
160
156
{
161
- // Don't throw from a Stop command
157
+ m_stoprequested = true ;
158
+ m_thread->join ();
159
+ m_thread.reset ();
162
160
}
163
161
}
162
+ catch (...)
163
+ {
164
+ // Don't throw from a Stop command
165
+ }
164
166
m_bIsStarted = false ;
165
167
return true ;
166
168
}
@@ -213,11 +215,10 @@ void DomoticzTCP::disconnectTCP()
213
215
m_stoprequested = true ;
214
216
if (m_socket != INVALID_SOCKET)
215
217
{
218
+ shutdown (m_socket, SHUT_RDWR);
216
219
closesocket (m_socket); // will terminate the thread
217
220
m_socket = INVALID_SOCKET;
218
- sleep_seconds (1 );
219
221
}
220
- // m_thread-> join();
221
222
}
222
223
223
224
void DomoticzTCP::Do_Work ()
You can’t perform that action at this time.
0 commit comments