Skip to content
This repository has been archived by the owner on Dec 7, 2018. It is now read-only.

Commit

Permalink
Merge pull request #168 from d-snp/master
Browse files Browse the repository at this point in the history
Revert removal of addr and peeraddr delegates
  • Loading branch information
digitalextremist committed Mar 12, 2015
2 parents 09df489 + 23afd8f commit 809d60d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/reel/websocket.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@

module Reel
class WebSocket
include Celluloid::Logger
extend Forwardable
include ConnectionMixin
include RequestMixin

attr_accessor :socket

attr_reader :socket
def_delegators :@socket, :addr, :peeraddr

def initialize(info, connection)
driver_env = DriverEnvironment.new(info, connection.socket)

Expand Down
9 changes: 9 additions & 0 deletions spec/reel/websocket_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,15 @@ def initialize(websocket)
end
end

it "exposes addr and peeraddr" do
with_websocket_pair do |client, websocket|
expect(websocket).to respond_to(:peeraddr)
expect(websocket.peeraddr.first).to eq "AF_INET"
expect(websocket).to respond_to(:addr)
expect(websocket.addr.first).to eq "AF_INET"
end
end

it "raises a RequestError when connection used after it was upgraded" do
with_socket_pair do |client, peer|
connection = Reel::Connection.new(peer)
Expand Down

0 comments on commit 809d60d

Please sign in to comment.