Skip to content

Commit

Permalink
More Rubocop compliance
Browse files Browse the repository at this point in the history
  • Loading branch information
ldilley committed Mar 23, 2015
1 parent 582da36 commit 3f770f2
Show file tree
Hide file tree
Showing 63 changed files with 746 additions and 764 deletions.
8 changes: 4 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
source 'http://rubygems.org'

raise "Ruby >=1.9.3 is required! Detected version: #{RUBY_VERSION}" unless RUBY_VERSION.to_s >= "1.9.3"
fail "Ruby >=1.9.3 is required! Detected version: #{RUBY_VERSION}" unless RUBY_VERSION.to_s >= '1.9.3'

# celluloid-io should automatically install celluloid and nio4r
gem "rake", ">= 10.1.0"
gem "celluloid-io", ">= 0.16.2"
gem "eventmachine", ">= 1.0.3"
gem 'rake', '>= 10.1.0'
gem 'celluloid-io', '>= 0.16.2'
gem 'eventmachine', '>= 1.0.3'
14 changes: 7 additions & 7 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
require 'rdoc/task'

rdoc_dir = "rdoc"
version = "0.2a"
rdoc_dir = 'rdoc'
version = '0.2a'

RDoc::Task.new do |rdoc|
rdoc.rdoc_dir = rdoc_dir
rdoc.title = "RubIRCd #{version}"
rdoc.main = "README.doc"
rdoc.rdoc_files.include("*.rb")
rdoc.rdoc_files.include("modules/*.rb")
rdoc.options << "--all"
rdoc.main = 'README.doc'
rdoc.rdoc_files.include('*.rb')
rdoc.rdoc_files.include('modules/*.rb')
rdoc.options << '--all'
end

task :install do
sh "bundle install"
sh 'bundle install'
end

task :default => [:install]
32 changes: 16 additions & 16 deletions cell.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@
exit!
end

# Handles event-driven I/O for network communication
# using Celluloid
# This class should offer better performance than
# native select() since it provides access to libev
# implementations of epoll and kqueue where available
class Cell
include Celluloid::IO
finalizer :shutdown
Expand All @@ -42,14 +47,13 @@ def initialize(host, plain_port, ssl_port)
# Since Celluloid::IO is included, this is a Celluloid::IO::TCPServer
@plain_server = TCPServer.new(host, plain_port)
async.plain_acceptor
unless Options.ssl_port.nil?
ssl_context = OpenSSL::SSL::SSLContext.new
ssl_context.cert = OpenSSL::X509::Certificate.new(File.read('cfg/cert.pem'))
ssl_context.key = OpenSSL::PKey::RSA.new(File.read('cfg/key.pem'))
@ssl_server = SSLServer.new(TCPServer.new(host, ssl_port), ssl_context)
async.ssl_acceptor
@connection_check_thread = Thread.new() { Network.connection_checker() }
end
return if Options.ssl_port.nil?
ssl_context = OpenSSL::SSL::SSLContext.new
ssl_context.cert = OpenSSL::X509::Certificate.new(File.read('cfg/cert.pem'))
ssl_context.key = OpenSSL::PKey::RSA.new(File.read('cfg/key.pem'))
@ssl_server = SSLServer.new(TCPServer.new(host, ssl_port), ssl_context)
async.ssl_acceptor
@connection_check_thread = Thread.new { Network.connection_checker }
end

def shutdown
Expand All @@ -66,21 +70,17 @@ def ssl_acceptor
end

def handle_plain_connections(plain_client)
Server.increment_clients()
Server.increment_clients
user = Network.register_connection(plain_client, nil)
unless Server.kline_mod == nil
Network.check_for_kline(user)
end
Network.check_for_kline(user) unless Server.kline_mod.nil?
Network.welcome(user)
Network.main_loop(user)
end

def handle_ssl_connections(ssl_client)
Server.increment_clients()
Server.increment_clients
user = Network.register_connection(ssl_client, nil)
unless Server.kline_mod == nil
Network.check_for_kline(user)
end
Network.check_for_kline(user) unless Server.kline_mod.nil?
Network.welcome(user)
Network.main_loop(user)
end
Expand Down
Loading

0 comments on commit 3f770f2

Please sign in to comment.