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.
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
|
# File 'lib/em/pure_ruby.rb', line 675
def initialize io
@io = io
@uuid = UuidGenerator.generate
@is_server = false
@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.
672
673
674
|
# File 'lib/em/pure_ruby.rb', line 672
def io
@io
end
|
#is_server ⇒ Object
Returns the value of attribute is_server.
672
673
674
|
# File 'lib/em/pure_ruby.rb', line 672
def is_server
@is_server
end
|
#uuid ⇒ Object
Returns the value of attribute uuid.
673
674
675
|
# File 'lib/em/pure_ruby.rb', line 673
def uuid
@uuid
end
|
Instance Method Details
#close_scheduled? ⇒ Boolean
703
704
705
|
# File 'lib/em/pure_ruby.rb', line 703
def close_scheduled?
@close_scheduled
end
|
#get_peername ⇒ Object
715
716
717
|
# File 'lib/em/pure_ruby.rb', line 715
def get_peername
nil
end
|
#heartbeat ⇒ Object
723
724
|
# File 'lib/em/pure_ruby.rb', line 723
def heartbeat
end
|
#schedule_close(after_writing = false) ⇒ Object
726
727
728
729
730
731
732
|
# File 'lib/em/pure_ruby.rb', line 726
def schedule_close(after_writing=false)
if after_writing
@close_requested = true
else
@close_scheduled = true
end
end
|
#select_for_reading? ⇒ Boolean
707
708
709
|
# File 'lib/em/pure_ruby.rb', line 707
def select_for_reading?
false
end
|
#select_for_writing? ⇒ Boolean
711
712
713
|
# File 'lib/em/pure_ruby.rb', line 711
def select_for_writing?
false
end
|
#set_inactivity_timeout(tm) ⇒ Object
719
720
721
|
# File 'lib/em/pure_ruby.rb', line 719
def set_inactivity_timeout tm
@inactivity_timeout = tm
end
|