lib/logstash/util/relp.rb in logstash-input-relp-2.0.1 vs lib/logstash/util/relp.rb in logstash-input-relp-2.0.2
- old
+ new
@@ -13,11 +13,11 @@
class FrameReadException < RelpError; end
class InsufficientCommands < RelpError; end
def valid_command?(command)
valid_commands = Array.new
-
+
#Allow anything in the basic protocol for both directions
valid_commands << 'open'
valid_commands << 'close'
#These are things that are part of the basic protocol, but only valid in one direction (rsp, close etc.) TODO: would they be invalid or just innapropriate?
@@ -100,11 +100,11 @@
class RelpServer < Relp
def initialize(host,port,required_commands=[],ssl_context=nil)
@logger = Cabin::Channel.get(LogStash)
-
+
@server=true
#These are things that are part of the basic protocol, but only valid in one direction (rsp, close etc.)
@basic_relp_commands = ['close']#TODO: check for others
@@ -195,17 +195,16 @@
frame = Hash.new
frame['txnr'] = 0
frame['command'] = 'serverclose'
begin
self.frame_write(socket,frame)
- socket.close
+ socket.close rescue nil
rescue ConnectionClosed
end
end
def shutdown
- @server.close
- rescue Exception#@server might already be down
+ @server.close rescue nil
end
def ack(socket, txnr)
frame = Hash.new
frame['txnr'] = txnr