diff options
author | David Robillard <d@drobilla.net> | 2012-07-26 15:33:40 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-07-26 15:33:40 +0000 |
commit | 4ad0afc4283ba54a8c63fbf5d05e203c06ea7747 (patch) | |
tree | a4a8056302b672805d5b0aa1b07deb5feab52f6d /src/server | |
parent | 3c5931bb13b5f88edcebb375fa6964dde8b85563 (diff) | |
download | ingen-4ad0afc4283ba54a8c63fbf5d05e203c06ea7747.tar.gz ingen-4ad0afc4283ba54a8c63fbf5d05e203c06ea7747.tar.bz2 ingen-4ad0afc4283ba54a8c63fbf5d05e203c06ea7747.zip |
Gracefully handle notification ring overflow.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4557 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/server')
-rw-r--r-- | src/server/Context.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/server/Context.cpp b/src/server/Context.cpp index 0736b451..86feaf67 100644 --- a/src/server/Context.cpp +++ b/src/server/Context.cpp @@ -51,8 +51,15 @@ Context::notify(LV2_URID key, const void* body) { const Notification n(port, time, key, size, type); - _event_sink.write(sizeof(n), &n); - _event_sink.write(size, body); + if (_event_sink.write_space() < sizeof(n) + size) { + Raul::warn("Notification ring overflow\n"); + } else { + if (_event_sink.write(sizeof(n), &n) != sizeof(n)) { + Raul::error("Error writing header to notification ring\n"); + } else if (_event_sink.write(size, body) != size) { + Raul::error("Error writing body to notification ring\n"); + } + } } void |