elasticsearch/logstash-forwarder — pull request #264 by avleen (2014-09-03 22:02:40+00:00)
Title: Prevent closing the wrong connection

In the event of an SSL error (eg, bad certificate from a client), `client` here still pointed to the last successful connection.
So when a client failed to connect, and `client` still pointed to the last successful connection, we were forcing that good connection to be closed.

This PR sets `client` to `nil`, before accepting a new connection, and then tests to make sure it's not `nil`, before closing it.

All credit to @keyurdg for spotting and fixing this.