From 6f4f934e361ec057f887ef25a57dea1fd7aa2189 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Thu, 11 May 2017 19:19:16 -0500 Subject: [PATCH] Return feature-not-implemented for unknown iq By default, blather treats both false and nil returns from a handler as a signal to pass control to the next handler. That's counter-intuitive, so let's over-ride that and always stop after the first handler (unless throw(:pass) is explicitly called). --- sgx-catapult.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sgx-catapult.rb b/sgx-catapult.rb index 265058a614493ed88a3a5326595291878e184ed3..acdac5b4a4600868669c94fea38a23f0cc7c3668 100755 --- a/sgx-catapult.rb +++ b/sgx-catapult.rb @@ -70,6 +70,7 @@ class SGXClient < Blather::Client begin v = block.call(stanza) v.catch(&method(:panic)) if v.is_a?(Promise) + true # Do not run other handlers unless throw :pass rescue Exception => e panic(e) end @@ -822,6 +823,14 @@ module SGXcatapult #write_to_stream s.approve! #write_to_stream s.request! end + + iq :get? do |i| + write_to_stream error_msg(i.reply, i.children, 'cancel', 'feature-not-implemented') + end + + iq :set? do |i| + write_to_stream error_msg(i.reply, i.children, 'cancel', 'feature-not-implemented') + end end [:INT, :TERM].each do |sig|