Skip to content
This repository has been archived by the owner on Jun 10, 2018. It is now read-only.

Commit

Permalink
Easy SSL
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanfb authored and sstephenson committed Feb 15, 2010
1 parent f59486c commit 6ef96dc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/hector.rb
Expand Up @@ -11,8 +11,10 @@
require "hector/session"

module Hector
def self.start_server(address = "0.0.0.0", port = 6767)
def self.start_server(address = "0.0.0.0", port = 6767, ssl_port = 6868)
EventMachine.start_server(address, port, Connection)
EventMachine.start_server(address, ssl_port, SSLConnection)
logger.info("Hector running on #{address}:#{port}")
logger.info("Secure Hector running on #{address}:#{ssl_port}")
end
end
11 changes: 11 additions & 0 deletions lib/hector/connection.rb
Expand Up @@ -98,4 +98,15 @@ def log_tag
end
end
end

class SSLConnection < Connection
def post_init
log(:info, "opened SSL connection")
start_tls
end

def ssl_handshake_completed
log(:info, "SSL handshake completed")
end
end
end

0 comments on commit 6ef96dc

Please sign in to comment.