lib/rbmk/peer.rb in rbmk-0.1.0.c vs lib/rbmk/peer.rb in rbmk-0.1.0.d
- old
+ new
@@ -1,10 +1,15 @@
module RBMK
class Peer
+ attr_accessor :socket, :host, :port
def initialize client
- @host = client.peeraddr[3]
- @port = client.peeraddr[1]
+ @socket = client
+ @host, @port = client.peeraddr.values_at 3, 1
+ end
+
+ def close
+ @socket.close
end
def to_s
sprintf '%s:%s', @host, @port
end