From dc0548bc7b9b833e1c64440d943dc235882f62cf Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 9 Jan 2019 19:43:44 +0100 Subject: Fix SocketWriter bundle delimiters In particular, this fixes ingenish. The old solution here was broken by changing to a single message() function since bundle_end() was no longer virtual. --- src/SocketWriter.cpp | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/SocketWriter.cpp b/src/SocketWriter.cpp index dcba5799..56ed8d55 100644 --- a/src/SocketWriter.cpp +++ b/src/SocketWriter.cpp @@ -18,6 +18,8 @@ #include #include +#include + #include "ingen/SocketWriter.hpp" #include "raul/Socket.hpp" @@ -35,6 +37,19 @@ SocketWriter::SocketWriter(URIMap& map, , _socket(std::move(sock)) {} +void +SocketWriter::message(const Message& message) +{ + TurtleWriter::message(message); + if (boost::get(&message)) { + fprintf(stderr, "BUNDLE END!\n"); + + // Send a null byte to indicate end of bundle + const char end[] = { 0 }; + send(_socket->fd(), end, 1, MSG_NOSIGNAL); + } +} + size_t SocketWriter::text_sink(const void* buf, size_t len) { @@ -45,14 +60,4 @@ SocketWriter::text_sink(const void* buf, size_t len) return ret; } -void -SocketWriter::bundle_end() -{ - TurtleWriter::bundle_end(); - - // Send a null byte to indicate end of bundle - const char end[] = { 0 }; - send(_socket->fd(), end, 1, MSG_NOSIGNAL); -} - } // namespace ingen -- cgit v1.2.1