Class: Subserver::Health
- Inherits:
-
Object
- Object
- Subserver::Health
- Defined in:
- lib/subserver/health.rb
Instance Attribute Summary collapse
-
#server ⇒ Object
Returns the value of attribute server.
Instance Method Summary collapse
-
#initialize ⇒ Health
constructor
A new instance of Health.
- #logger ⇒ Object
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
Instance Attribute Details
#server ⇒ Object
Returns the value of attribute server.
6 7 8 |
# File 'lib/subserver/health.rb', line 6 def server @server end |
Instance Method Details
#start ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/subserver/health.rb', line 12 def start begin logger.debug "Health check avalible on port #{@server.addr[1]}" while session = @server.accept request = session.gets session.print "HTTP/1.1 200\r\n" # 1 session.print "Content-Type: text/html\r\n" # 2 session.print "\r\n" # 3 session.print "Subserver Online" #4 session.close end rescue Errno::ECONNRESET, Errno::EPIPE => e puts e. retry end end |
#stop ⇒ Object
30 31 32 |
# File 'lib/subserver/health.rb', line 30 def stop @server.close end |