Changeset 248

Show
Ignore:
Timestamp:
08/19/06 09:02:44 (2 years ago)
Author:
blackhedd
Message:

supported get_peername for connected streams

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • version_0/lib/pr_eventmachine.rb

    r246 r248  
    3535#  
    3636 
     37# TODO List: 
     38# TCP-connects currently assume non-blocking connect is available- need to 
     39#  degrade automatically on versions of Ruby prior to June 2006. 
     40# 
    3741 
    3842require 'singleton' 
     
    107111    def signal_loopbreak 
    108112      Reactor.instance.signal_loopbreak 
     113    end 
     114 
     115    # #get_peername 
     116    def get_peername sig 
     117      selectable = Reactor.instance.get_selectable( sig ) or raise "unknown get_peername target" 
     118      selectable.get_peername 
    109119    end 
    110120 
     
    277287  def_delegator :@my_selectable, :send_data 
    278288  def_delegator :@my_selectable, :schedule_close 
     289  def_delegator :@my_selectable, :get_peername 
    279290end 
    280291 
     
    311322    def select_for_writing? 
    312323      false 
     324    end 
     325 
     326    def get_peername 
     327      nil 
    313328    end 
    314329 
     
    428443    end 
    429444 
     445    # #get_peername 
     446    # This is defined in the normal way on connected stream objects. 
     447    # Return an object that is suitable for passing to Socket#unpack_sockaddr_in or variants. 
     448    # We could also use a convenience method that did the unpacking automatically. 
     449    def get_peername 
     450      io.getpeername 
     451    end 
     452 
    430453  end 
    431454 
  • version_0/ReleaseAnnouncement

    r247 r248  
    1515Support for user-defined events. 
    1616 
     17Stable APIs- use without worrying about having your code break. 
     18 
    1719------------ 
    1820