hokaido 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 84ff69267500b6524e74a935447b3389a6299f2a
4
- data.tar.gz: c46d68b17486d2e932a03788100354283bcd1938
3
+ metadata.gz: a034a0ff0f3cedd6382eb86ae51ff8523ff8eb20
4
+ data.tar.gz: f53b297978f645effeb1f1be82894dbe92bfe81e
5
5
  SHA512:
6
- metadata.gz: 7dbd14e42abaae8ff7097ae0f5c4c2d9bd853f115315ace28738721d3c5777421c6b8b29d1cbb25cfca250bcbdaecbf6f459718b27248830f3474e42a905835f
7
- data.tar.gz: 9063491ced10eb39f39426736e78bb8a7ec028b155e187e27a6ca29b07ce5182e01ac01f26e8de72fc1e008d092c55889985b413f7b2d1cc8f2c7211494f28b0
6
+ metadata.gz: faf17bfa95c94ee6e8bc70a019af4f2466d19fccbb5831894d170026b50de9cb696b9cc24f1958efdf9029be67895960f3b84c0c94d1baf2074aa24d673c5d18
7
+ data.tar.gz: 59b74a223302ea2b9f976f3e7eaad2b15bc9ca27d0213d12773667c6c9d956f2672906b6e7ce4d3e5a7f24642d98f83094873d2da7d34babe573718e8743cedc
@@ -34,7 +34,9 @@ module Hokaido
34
34
  $stdout.write chunk
35
35
  @connection.async.send chunk
36
36
  end
37
-
37
+ rescue EOFError, Errno::EIO
38
+ # do nothing
39
+ ensure
38
40
  terminate
39
41
  end
40
42
  end
@@ -32,10 +32,10 @@ module Hokaido
32
32
  while chunk = server.readpartial(4096)
33
33
  $stdout.write chunk
34
34
  end
35
- rescue Interrupt
36
- server.close
37
-
38
- exit
35
+ rescue Interrupt, EOFError, Errno::EIO
36
+ # do nothing
37
+ ensure
38
+ server.close if server
39
39
  end
40
40
 
41
41
  desc :version, 'Show hokaido version'
@@ -22,22 +22,20 @@ module Hokaido
22
22
  when 'broadcast'
23
23
  @connection.puts ':)'
24
24
 
25
- loop do
26
- publish 'broadcast', @connection.readpartial(4096)
25
+ while chunk = @connection.readpartial(4096)
26
+ publish 'broadcast', chunk
27
27
  end
28
28
  when 'watch'
29
29
  @connection.puts '=)'
30
30
 
31
- watcher = Watcher.new_link(@connection)
31
+ Watcher.new(@connection).link Actor.current
32
32
 
33
- loop do
34
- @connection.readpartial(4096) # XXX wait for connection closed
35
- end
33
+ Kernel.sleep
36
34
  else
37
35
  @connection.puts ':('
38
36
  end
39
- rescue Errno::ECONNRESET
40
- # do nothing, connetion reset by peer
37
+ rescue EOFError, Errno::EIO, Errno::ECONNRESET
38
+ # do nothing
41
39
  ensure
42
40
  puts "#{host}:#{port} disconnected"
43
41
 
@@ -62,7 +60,7 @@ module Hokaido
62
60
 
63
61
  def run
64
62
  loop do
65
- ConnectionHandler.new_link @server.accept
63
+ ConnectionHandler.new(@server.accept).link Actor.current
66
64
  end
67
65
  end
68
66
  end
@@ -1,3 +1,3 @@
1
1
  module Hokaido
2
- VERSION = '0.0.6'
2
+ VERSION = '0.0.7'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hokaido
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - ursm