Sha256: a7322ec5c79eed408db6db863b0ed669499ba5305c62eaa3b7056471b63ecaa4
Contents?: true
Size: 1.21 KB
Versions: 3
Compression:
Stored size: 1.21 KB
Contents
require 'puggernaut/server/http' require 'puggernaut/server/channel' require 'puggernaut/server/tcp' module Puggernaut class Server include Logger def initialize(http_port=8000, tcp_port=http_port+1) puts "\nPuggernaut is starting on #{http_port} (HTTP) and #{tcp_port} (TCP)" puts "*snort*\n\n" errors = 0 while errors <= 10 begin Channel.channels = [] GC.start EM.epoll if EM.epoll? EM.run do logger.info "Server#initialize - Starting HTTP - #{http_port}" EM.start_server '0.0.0.0', http_port, Http logger.info "Server#initialize - Starting TCP - #{tcp_port}" EM.start_server '0.0.0.0', tcp_port, Tcp errors = 0 end rescue Interrupt logger.info "Server#initialize - Shutting down" exit rescue errors += 1 logger.error "Server#initialize - Error - #{$!.message}" logger.error "\t" + $!.backtrace.join("\n\t") end end puts "Exiting because of too many consecutive errors :(" puts "Check #{Dir.pwd}/log/puggernaut.log\n\n" end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
puggernaut-0.1.3 | lib/puggernaut/server.rb |
puggernaut-0.1.2 | lib/puggernaut/server.rb |
puggernaut-0.1.0 | lib/puggernaut/server.rb |