Class: Rumid::TcpServer

Inherits:
GServer
  • Object
show all
Defined in:
lib/rumid/tcp_server.rb

Overview

Extended GServer, baked to work with Rumid::Server servers

Instance Method Summary collapse

Constructor Details

#initialize(port, protocol_server, *args) ⇒ TcpServer


8
9
10
11
# File 'lib/rumid/tcp_server.rb', line 8

def initialize(port, protocol_server, *args)
  super(port, *args)
  @protocol_server = protocol_server
end

Instance Method Details

#serve(session) ⇒ Object

Note:

Typicaly you should not call this method

Overriden Gserver#serve function.


17
18
19
20
21
22
23
24
25
# File 'lib/rumid/tcp_server.rb', line 17

def serve(session)
  loop{
    begin
      @protocol_server.new.serve(session)
    rescue Rumid::Errors::NotValidRequestError
      log "Error in validation occured!"
    end
  }
end