diff options
author | Eric Wong <e@80x24.org> | 2015-12-13 12:44:21 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2015-12-13 12:47:03 +0000 |
commit | d628e9bd3c5ef42e44c8e14f8eaf9a85dd541a4c (patch) | |
tree | 2ce52d31cfa4a9659deead461d5fdabbfc97a6d3 | |
parent | c52372da41d831ae93bbb3a0578792737c9395d5 (diff) | |
download | dtas-d628e9bd3c5ef42e44c8e14f8eaf9a85dd541a4c.tar.gz |
Do not batch processing of requests or buffered output. We cannot have clients running "dtas-tl cat" or similar to dump a gigantic playlist cause us to have gaps in our playback. Since we implemented a tunable tracklist limit, we can also remove the hardcoded 100 element limit for buffered messages while we're at it; now the tracklist limit affects maximum memory use.
-rw-r--r-- | lib/dtas/unix_accepted.rb | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/dtas/unix_accepted.rb b/lib/dtas/unix_accepted.rb index 7db3ed5..e683fb2 100644 --- a/lib/dtas/unix_accepted.rb +++ b/lib/dtas/unix_accepted.rb @@ -21,8 +21,6 @@ class DTAS::UNIXAccepted # :nodoc: when :wait_writable then @send_buf << msg end rv - elsif buffered > 100 - RuntimeError.new("too many messages buffered") else # buffered > 0 @send_buf << msg :wait_writable @@ -37,8 +35,8 @@ class DTAS::UNIXAccepted # :nodoc: when :wait_writable then return :wait_writable else @send_buf.shift - end until @send_buf.empty? - :wait_readable + @send_buf.empty? ? :wait_readable : :wait_writable + end rescue => e e end @@ -54,9 +52,8 @@ class DTAS::UNIXAccepted # :nodoc: when '', nil then return nil # EOF else yield(self, msg) # DTAS::Player deals with this - nread = @to_io.nread - end while nread > 0 - :wait_readable + end + @send_buf.empty? ? :wait_readable : :wait_writable rescue SystemCallError nil end |