diff options
author | Eric Wong <normalperson@yhbt.net> | 2013-08-26 06:16:39 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2013-08-26 06:16:39 +0000 |
commit | 8460df3e4e3320006ab945dfbbf01474387f1e13 (patch) | |
tree | 97dadfbd5163962eca34e1e4a0d37a409ba6ca03 | |
parent | 57bd6f96e007097219cdd31b034f8ca386927ed6 (diff) | |
download | dtas-8460df3e4e3320006ab945dfbbf01474387f1e13.tar.gz |
While we're at it, add a test for this functionality, too.
-rw-r--r-- | lib/dtas/player/client_handler.rb | 2 | ||||
-rw-r--r-- | lib/dtas/sink.rb | 1 | ||||
-rw-r--r-- | test/test_sink_pipe_size.rb | 20 |
3 files changed, 22 insertions, 1 deletions
diff --git a/lib/dtas/player/client_handler.rb b/lib/dtas/player/client_handler.rb index d580695..7028c5e 100644 --- a/lib/dtas/player/client_handler.rb +++ b/lib/dtas/player/client_handler.rb @@ -141,7 +141,7 @@ module DTAS::Player::ClientHandler # :nodoc: rv = set_bool(io, kv, v) { |b| sink.__send__("#{k}=", b) } rv == true or return rv when "pipe_size" - rv = set_uint(io, kv, v, true) { |u| sink.__send__("#{k}=", u) } + rv = set_uint(io, kv, v, false) { |u| sink.pipe_size = u } rv == true or return rv when "command" # nothing to validate, this could be "rm -rf /" :> sink.command = v.empty? ? DTAS::Sink::SINK_DEFAULTS["command"] : v diff --git a/lib/dtas/sink.rb b/lib/dtas/sink.rb index 836b0f1..7ecc52b 100644 --- a/lib/dtas/sink.rb +++ b/lib/dtas/sink.rb @@ -15,6 +15,7 @@ class DTAS::Sink # :nodoc: attr_accessor :prio # any Integer attr_accessor :active # boolean attr_accessor :name + attr_accessor :pipe_size attr_accessor :nonblock include DTAS::Command diff --git a/test/test_sink_pipe_size.rb b/test/test_sink_pipe_size.rb new file mode 100644 index 0000000..ce79b56 --- /dev/null +++ b/test/test_sink_pipe_size.rb @@ -0,0 +1,20 @@ +# -*- encoding: binary -*- +# Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> +# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +begin + require 'io/splice' + require './test/player_integration' + class TestSinkPipeSizeIntegration < Minitest::Unit::TestCase + include PlayerIntegration + + def test_sink_pipe_size_integration + s = client_socket + default_sink_pid(s) + s.req_ok("sink ed default pipe_size=0x1000") + s.req_ok("sink ed default pipe_size=0x10000") + assert_match %r{\AERR }, s.req("sink ed default pipe_size=") + s.req_ok("sink ed default pipe_size=4096") + end if IO.method_defined?(:pipe_size=) + end +rescue LoadError +end |