Class: EventMachine::Selectable

Inherits:
Object
  • Object
show all
Defined in:
lib/pr_eventmachine.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(io) ⇒ Selectable

Returns a new instance of Selectable.



426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
# File 'lib/pr_eventmachine.rb', line 426

def initialize io
  @uuid = UuidGenerator.generate
  @io = io
  @last_activity = Reactor.instance.current_loop_time

  m = @io.fcntl(Fcntl::F_GETFL, 0)
  @io.fcntl(Fcntl::F_SETFL, Fcntl::O_NONBLOCK | m)
  # TODO, should set CLOEXEC on Unix?

  @close_scheduled = false
  @close_requested = false

  se = self; @io.instance_eval { @my_selectable = se }
  Reactor.instance.add_selectable @io
end

Instance Attribute Details

#ioObject (readonly)

Returns the value of attribute io.



424
425
426
# File 'lib/pr_eventmachine.rb', line 424

def io
  @io
end

#uuidObject (readonly)

Returns the value of attribute uuid.



424
425
426
# File 'lib/pr_eventmachine.rb', line 424

def uuid
  @uuid
end

Instance Method Details

#close_scheduled?Boolean

Returns:

  • (Boolean)


442
443
444
# File 'lib/pr_eventmachine.rb', line 442

def close_scheduled?
  @close_scheduled
end

#get_peernameObject



454
455
456
# File 'lib/pr_eventmachine.rb', line 454

def get_peername
  nil
end

#heartbeatObject



462
463
# File 'lib/pr_eventmachine.rb', line 462

def heartbeat
end

#select_for_reading?Boolean

Returns:

  • (Boolean)


446
447
448
# File 'lib/pr_eventmachine.rb', line 446

def select_for_reading?
  false
end

#select_for_writing?Boolean

Returns:

  • (Boolean)


450
451
452
# File 'lib/pr_eventmachine.rb', line 450

def select_for_writing?
  false
end

#set_inactivity_timeout(tm) ⇒ Object



458
459
460
# File 'lib/pr_eventmachine.rb', line 458

def set_inactivity_timeout tm
  @inactivity_timeout = tm
end