Method: NATS#process_disconnect

Defined in:
lib/nats/client.rb

#process_disconnectObject

:nodoc:


1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
# File 'lib/nats/client.rb', line 1181

def process_disconnect #:nodoc:
  # Mute error callback when user has called NATS.close on purpose.
  if not closing? and @err_cb
    # Always call error callback for compatibility with previous behavior.
    err_cb.call(NATS::ConnectError.new(disconnect_error_string))
  end
  close_cb.call if @close_cb

  true # Chaining
ensure
  cancel_ping_timer
  cancel_reconnect_timer
  if (NATS.client == self)
    NATS.clear_client
    EM.stop if ((connected? || reconnecting?) and closing? and not NATS.reactor_was_running?)
  end
  @connected = @reconnecting = false
end