diff --git a/library/socket/fixtures/classes.rb b/library/socket/fixtures/classes.rb index 4a590502ca..dc4cadf02f 100644 --- a/library/socket/fixtures/classes.rb +++ b/library/socket/fixtures/classes.rb @@ -118,14 +118,14 @@ def service(socket) socket.send data, 0 ensure - socket.close + socket.close unless socket.closed? end end def shutdown log "SpecTCPServer shutting down" + @server.close unless @server.closed? @thread.join - @server.close end def log(message) diff --git a/library/socket/udpsocket/send_spec.rb b/library/socket/udpsocket/send_spec.rb index 5d5de684af..5ef044c999 100644 --- a/library/socket/udpsocket/send_spec.rb +++ b/library/socket/udpsocket/send_spec.rb @@ -16,13 +16,14 @@ retry end ensure - @server.close if !@server.closed? + @server.close unless @server.closed? end end Thread.pass while @server_thread.status and !@port end after :each do + @server.close unless @server.closed? @server_thread.join end