Creating a new socket is #new, not #connect

This commit is contained in:
Nick Thomas
2011-11-13 18:43:43 +00:00
parent 51175ddf56
commit 875820f011
2 changed files with 4 additions and 4 deletions

View File

@@ -11,14 +11,14 @@ require 'qmp_client/messages'
module QMPClient
def self.connect_unix(filename, &blk)
sock = UNIXSocket.connect(filename)
sock = UNIXSocket.new(filename)
connect_socket(sock, &blk)
ensure
sock.close if sock && !sock.closed?
end
def self.connect_tcp(host, port, local_host=nil, local_port=nil, &blk)
sock = TCPSocket.connect(host, port, local_host, local_port)
sock = TCPSocket.new(host, port, local_host, local_port)
connect_socket(sock, &blk)
ensure
sock.close if sock && !sock.closed?