Class: PDTP::Server::Connection
- Inherits:
-
Protocol
- Object
- EventMachine::Connection
- LengthPrefixProtocol
- Protocol
- PDTP::Server::Connection
- Defined in:
- lib/pdtp/server/connection.rb
Instance Attribute Summary collapse
-
#dispatcher ⇒ Object
Returns the value of attribute dispatcher.
-
#user_data ⇒ Object
Returns the value of attribute user_data.
Instance Method Summary collapse
- #connection_completed ⇒ Object
- #connection_destroyed ⇒ Object
-
#file_service? ⇒ Boolean
Is this connection the file service?.
-
#mark_as_file_service ⇒ Object
Mark this connection as being a file service.
- #receive_message(command, message) ⇒ Object
Methods inherited from Protocol
#connection_open?, define_message_params, #error_close_connection, #get_peer_info, #hash_to_range, #initialize, obj_matches_type?, #post_init, print_info, #range_to_hash, #receive_packet, #remote_peer_id, #send_message, #to_s, #unbind, validate_message
Methods inherited from LengthPrefixProtocol
#initialize, #prefix_size=, #receive_data, #receive_packet, #send_packet
Constructor Details
This class inherits a constructor from PDTP::Protocol
Instance Attribute Details
#dispatcher ⇒ Object
Returns the value of attribute dispatcher.
28 29 30 |
# File 'lib/pdtp/server/connection.rb', line 28 def dispatcher @dispatcher end |
#user_data ⇒ Object
Returns the value of attribute user_data.
29 30 31 |
# File 'lib/pdtp/server/connection.rb', line 29 def user_data @user_data end |
Instance Method Details
#connection_completed ⇒ Object
41 42 43 44 |
# File 'lib/pdtp/server/connection.rb', line 41 def connection_completed raise(RuntimeError, 'server was never initialized') unless @dispatcher @dispatcher.connection_created self end |
#connection_destroyed ⇒ Object
46 47 48 49 |
# File 'lib/pdtp/server/connection.rb', line 46 def connection_destroyed raise(RuntimeError, 'server was never initialized') unless @dispatcher @dispatcher.connection_destroyed self end |
#file_service? ⇒ Boolean
Is this connection the file service?
32 33 34 |
# File 'lib/pdtp/server/connection.rb', line 32 def file_service? @file_service end |
#mark_as_file_service ⇒ Object
Mark this connection as being a file service
37 38 39 |
# File 'lib/pdtp/server/connection.rb', line 37 def mark_as_file_service @file_service = true end |
#receive_message(command, message) ⇒ Object
51 52 53 54 |
# File 'lib/pdtp/server/connection.rb', line 51 def (command, ) raise(RuntimeError, 'server was never initialized') unless @dispatcher @dispatcher. command, , self end |