Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-825

disconnect! when a socket error occurs in Connection#dispatch

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.0.0
    • Affects Version/s: 2.0.0
    • Component/s: None
    • None

      disconnect! is necessary on a Mongo::SocketError, otherwise we'll repeat using a bad connection. The following patch illustrates this.

        class Connection
          def dispatch(messages)
            begin
              write(messages)
              messages.last.replyable? ? read : nil
            rescue Mongo::SocketError => e
              disconnect!
              raise e
            end
          end
        end
      

      Refactoring to avoid rescue/raise would be nice.

            Assignee:
            durran.jordan@mongodb.com Durran Jordan
            Reporter:
            gjmurakami Gary Murakami
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: