Method: Relay#unbind

Defined in:
lib/relay.rb

#unbind(errno) ⇒ Object



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/relay.rb', line 64

def unbind(errno)
  if errno
    if errno == Errno::ETIMEDOUT && @connection_inactivity_timeout > 0
      reason = "inactivity"
    elsif errno.respond_to?(:exception)
      reason = errno.exception.message
      reason[0] = reason[0].downcase
    else
      # win: errno can be set to :unknown on windows
      reason = errno.to_s
    end
    reason = reason.inspect
  end
  @log.call "[-] unbind.", reason: reason
  @closed = true
  if @ws&.state == :connected
    @ws.send_text("unbind")
    @unbind_sent = true
    @completion&.succeed if @unbind_recv
  end
end