Check #closed? instead of rescuing.
parent
98628b814e
commit
42d59d269e
|
@ -198,14 +198,7 @@ class Client
|
||||||
def close
|
def close
|
||||||
if (self.conn)
|
if (self.conn)
|
||||||
self.conn.shutdown
|
self.conn.shutdown
|
||||||
|
self.conn.close unless self.conn.closed?
|
||||||
begin
|
|
||||||
self.conn.close
|
|
||||||
rescue IOError => e
|
|
||||||
# sometimes, the socket might already be closed, which will
|
|
||||||
# cause conn.close to raise an IOError. Since we just care
|
|
||||||
# about the socket closing itself here, we ignore the exception.
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
self.conn = nil
|
self.conn = nil
|
||||||
|
|
Loading…
Reference in New Issue