Changeset 152

Show
Ignore:
Timestamp:
05/26/06 22:21:24 (2 years ago)
Author:
blackhedd
Message:

added reuseaddr flag to TCP acceptors

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • experiments/machine/lib/machine/eio.rb

    r148 r152  
    7373      end 
    7474    } 
     75    add_handler(:close_after_writing) { 
     76      close_after_writing 
     77    } 
    7578 
    7679    log.debug "Pushed EventableIO (#{@@io_objects.size})" 
     
    116119  def send_data data 
    117120    send_event( DataEvent.new( :write, data )) 
     121  end 
     122 
     123  def send_close_after_writing 
     124    send_event( Event.new( :close_after_writing )) 
    118125  end 
    119126 
     
    243250  def self.start_server host, port 
    244251    sd = Socket.new( Socket::AF_INET, Socket::SOCK_STREAM, 0 ) 
     252    sd.setsockopt( Socket::SOL_SOCKET, Socket::SO_REUSEADDR, true ) 
    245253    sd.bind( Socket.pack_sockaddr_in( port, host )) 
    246254    sd.listen( 50 ) # 5 is what you see in all the books. Ain't enough.