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

Commit

Permalink
Merge pull request #48 from Chewie/examples_finalizer
Browse files Browse the repository at this point in the history
Updated examples for the new finalizer API
  • Loading branch information
benlangfeld committed Mar 30, 2013
2 parents f4209c2 + 2d49170 commit 20362c6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions examples/echo_server.rb
Expand Up @@ -7,6 +7,7 @@

class EchoServer
include Celluloid::IO
finalizer :finalize

def initialize(host, port)
puts "*** Starting echo server on #{host}:#{port}"
Expand Down
3 changes: 2 additions & 1 deletion examples/echo_unix_client.rb
Expand Up @@ -3,6 +3,7 @@

class EchoUNIXClient
include Celluloid::IO
finalizer :finalize

def initialize(socket_path)
puts "*** connecting to #{socket_path}"
Expand All @@ -25,4 +26,4 @@ def finalize
end

c = EchoUNIXClient.new("/tmp/sock_test")
c.echo("DATA")
c.echo("DATA")
5 changes: 3 additions & 2 deletions examples/echo_unix_server.rb
Expand Up @@ -3,7 +3,8 @@

class EchoUNIXServer
include Celluloid::IO

finalizer :finalize

attr_reader :socket_path, :server

def initialize(socket_path)
Expand All @@ -23,7 +24,7 @@ def handle_connection(socket)
puts "*** gets data #{data}"
socket.write(data)
end

rescue EOFError
puts "*** disconnected"

Expand Down

0 comments on commit 20362c6

Please sign in to comment.