lib/grocer/ssl_server.rb in grocer-0.0.12 vs lib/grocer/ssl_server.rb in grocer-0.0.13
- old
+ new
@@ -24,15 +24,22 @@
yield socket if block_given?
end
end
def close
- if @ssl_socket
- @ssl_socket.shutdown
+ if @ssl_socket && !@ssl_socket.closed?
+ begin
+ @ssl_socket.shutdown
+ rescue Errno::ENOTCONN
+ # Some platforms raise this if the socket is not connected. Not sure
+ # how to avoid it.
+ end
+
@ssl_socket.close
- @ssl_socket = nil
- @socket = nil
end
+
+ @ssl_socket = nil
+ @socket = nil
end
private
def ssl_socket