freebsd-ports/comms/telldus-core/files/patch-common-Socket_unix.cpp
John Marino 941fc51733 Add new port comms/telldus-core
PR:		189221
Submitted by:	johan (stromnet.se)

Allows access to Telldus Tellstick USB dongles for communicating with
433MHz devices in your home.

Provides "telldusd", the daemon which keeps track of your tellstick
devices. Through a UNIX socket, the sensors and devices can be used/
controlled from the command line tool "tdtool", or via the libtelldus-core
C client library.
2014-08-15 14:43:47 +00: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) {