From 595e4f539b73a46c428a2e84b5e0f37e0f48a9b8 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 21 Dec 2012 02:52:53 +0000 Subject: Send a null terminator on bundle boundaries so reading replies from the socket is simple. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4869 a436a847-0d15-0410-975c-d299462d15a1 --- src/socket/SocketWriter.cpp | 10 ++++++++++ src/socket/SocketWriter.hpp | 2 ++ 2 files changed, 12 insertions(+) (limited to 'src/socket') diff --git a/src/socket/SocketWriter.cpp b/src/socket/SocketWriter.cpp index f66606be..19a1c713 100644 --- a/src/socket/SocketWriter.cpp +++ b/src/socket/SocketWriter.cpp @@ -85,5 +85,15 @@ SocketWriter::write(const LV2_Atom* msg) return true; } +void +SocketWriter::bundle_end() +{ + AtomWriter::bundle_end(); + + // Send a NULL byte to indicate end of bundle + const char end[] = { 0 }; + send(fd(), end, 1, MSG_NOSIGNAL); +} + } // namespace Socket } // namespace Ingen diff --git a/src/socket/SocketWriter.hpp b/src/socket/SocketWriter.hpp index cbdb2602..d6ba5dd3 100644 --- a/src/socket/SocketWriter.hpp +++ b/src/socket/SocketWriter.hpp @@ -45,6 +45,8 @@ public: bool write(const LV2_Atom* msg); + void bundle_end(); + int fd() { return _socket->fd(); } Raul::URI uri() const { return _uri; } -- cgit v1.2.1