Class: BBFS::ContentServer::RemoteContentClient

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

Instance Method Summary collapse

Constructor Details

#initialize(dynamic_content_data, port) ⇒ RemoteContentClient

Returns a new instance of RemoteContentClient.



78
79
80
81
# File 'lib/content_server/remote_content.rb', line 78

def initialize(dynamic_content_data, port)
  @dynamic_content_data = dynamic_content_data
  @tcp_server = Networking::TCPServer.new(port, method(:content_requested))
end

Instance Method Details

#content_requested(addr_info, message) ⇒ Object



83
84
85
86
87
# File 'lib/content_server/remote_content.rb', line 83

def content_requested(addr_info, message)
  # Send response.
  Log.debug1('Local content data requested.')
  @tcp_server.send_obj(@dynamic_content_data.last_content_data)
end

#tcp_threadObject



89
90
91
92
# File 'lib/content_server/remote_content.rb', line 89

def tcp_thread
  return @tcp_server.tcp_thread if @tcp_server != nil
  nil
end