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

Commit

Permalink
Use new wrappers.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Mar 11, 2016
1 parent 706b47e commit 9955a17
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions lib/celluloid/dns/server.rb
Expand Up @@ -24,18 +24,6 @@
require_relative 'logger'

module Celluloid::DNS
class UDPSocketWrapper < Celluloid::IO::UDPSocket
def initialize(socket)
@socket = socket
end
end

class TCPServerWrapper < Celluloid::IO::TCPServer
def initialize(server)
@server = server
end
end

class Server
include Celluloid::IO

Expand Down Expand Up @@ -139,10 +127,10 @@ def run
case protocol
when Socket::SOCK_DGRAM
@logger.info "<> Attaching to pre-existing UDP socket #{ip}:#{port}"
link UDPSocketHandler.new(self, UDPSocketWrapper.new(spec))
link UDPSocketHandler.new(self, Celluloid::IO::Socket.try_convert(spec))
when Socket::SOCK_STREAM
@logger.info "<> Attaching to pre-existing TCP socket #{ip}:#{port}"
link TCPSocketHandler.new(self, TCPServerWrapper.new(spec))
link TCPSocketHandler.new(self, Celluloid::IO::Socket.try_convert(spec))
else
raise ArgumentError.new("Unknown socket protocol: #{protocol}")
end
Expand Down

0 comments on commit 9955a17

Please sign in to comment.