Class: EventMachine::Selectable
- Inherits:
-
Object
- Object
- EventMachine::Selectable
show all
- Defined in:
- lib/em/pure_ruby.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of Selectable.
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
|
# File 'lib/em/pure_ruby.rb', line 453
def initialize io
@uuid = UuidGenerator.generate
@io = io
@last_activity = Reactor.instance.current_loop_time
if defined?(Fcntl::F_GETFL)
m = @io.fcntl(Fcntl::F_GETFL, 0)
@io.fcntl(Fcntl::F_SETFL, Fcntl::O_NONBLOCK | m)
else
begin
s = Socket.for_fd(@io.fileno)
s.fcntl( Fcntl::F_SETFL, Fcntl::O_NONBLOCK )
rescue Errno::EINVAL, Errno::EBADF
warn "Serious error: unable to set descriptor non-blocking"
end
end
@close_scheduled = false
@close_requested = false
se = self; @io.instance_eval { @my_selectable = se }
Reactor.instance.add_selectable @io
end
|
Instance Attribute Details
#io ⇒ Object
Returns the value of attribute io.
451
452
453
|
# File 'lib/em/pure_ruby.rb', line 451
def io
@io
end
|
#uuid ⇒ Object
Returns the value of attribute uuid.
451
452
453
|
# File 'lib/em/pure_ruby.rb', line 451
def uuid
@uuid
end
|
Instance Method Details
#close_scheduled? ⇒ Boolean
480
481
482
|
# File 'lib/em/pure_ruby.rb', line 480
def close_scheduled?
@close_scheduled
end
|
#get_peername ⇒ Object
492
493
494
|
# File 'lib/em/pure_ruby.rb', line 492
def get_peername
nil
end
|
#heartbeat ⇒ Object
500
501
|
# File 'lib/em/pure_ruby.rb', line 500
def heartbeat
end
|
#select_for_reading? ⇒ Boolean
484
485
486
|
# File 'lib/em/pure_ruby.rb', line 484
def select_for_reading?
false
end
|
#select_for_writing? ⇒ Boolean
488
489
490
|
# File 'lib/em/pure_ruby.rb', line 488
def select_for_writing?
false
end
|
#set_inactivity_timeout(tm) ⇒ Object
496
497
498
|
# File 'lib/em/pure_ruby.rb', line 496
def set_inactivity_timeout tm
@inactivity_timeout = tm
end
|