opnsense-ports/comms/telldus-core/files/patch-common-Socket_unix.cpp
Franco Fichtner 8cb1a96ede ports: pull in a snapshot of the FreeBSD ports tree
Taken from:	https://github.com/freebsd/freebsd-ports.git
Commit id:	5070672073b68be364139bc6b3a89100bd17d331
2014-11-09 14:03:21 +01:00

24 lines
654 B
C++

--- common/Socket_unix.cpp
+++ common/Socket_unix.cpp
@@ -18,7 +18,7 @@
#include "common/Strings.h"
#define BUFSIZE 512
-#if defined(_MACOSX) && !defined(SOCK_CLOEXEC)
+#if (defined(_MACOSX) || defined (__FreeBSD__)) && !defined(SOCK_CLOEXEC)
#define SOCK_CLOEXEC 0
#endif
@@ -130,8 +130,10 @@ std::wstring Socket::read(int timeout) {
void Socket::stopReadWait() {
TelldusCore::MutexLocker locker(&d->mutex);
- d->connected = false;
- // TODO(stefan): somehow signal the socket here?
+ if(d->connected && d->socket != -1) {
+ d->connected = false;
+ shutdown(d->socket, SHUT_RDWR);
+ }
}
void Socket::write(const std::wstring &msg) {