~singpolyma/sgx-jmp

245d66ee8b9412c05afdc77121e814de4f5e72e6 — Stephen Paul Weber 1 year, 7 months ago 136e2a0
Don't send too big timeout to bandwidth
2 files changed, 6 insertions(+), 1 deletions(-)

M lib/customer_fwd.rb
M test/test_customer_fwd.rb
M lib/customer_fwd.rb => lib/customer_fwd.rb +1 -1
@@ 22,7 22,7 @@ class CustomerFwd
		end

		def initialize(s)
			@timeout = s.nil? || s.to_i.negative? ? 300 : s.to_i
			@timeout = s.nil? || s.to_i.negative? || s.to_i > 300 ? 300 : s.to_i
		end

		def zero?

M test/test_customer_fwd.rb => test/test_customer_fwd.rb +5 -0
@@ 12,6 12,11 @@ class Rantly
end

class CustomerFwdTest < Minitest::Test
	def test_too_big_timeout
		fwd = CustomerFwd.for(uri: "xmpp:test@example.com", timeout: 500)
		assert_equal 300, fwd.timeout.to_i
	end

	property(:for_xmpp) { jid }
	def for_xmpp(jid)
		sip = "sip:#{ERB::Util.url_encode(jid.to_s)}@sip.cheogram.com"