uv-rays 2.3.0 → 2.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,44 +1,44 @@
1
- # frozen_string_literal: true
2
-
3
- module UV
4
- class TcpServer < ::Libuv::TCP
5
- def initialize(reactor, server, port, klass, *args)
6
- super(reactor)
7
-
8
- @klass = klass
9
- @args = args
10
-
11
- if server == port && port.is_a?(Integer)
12
- # We are opening a socket descriptor
13
- open(server)
14
- else
15
- # Perform basic checks before attempting to bind address
16
- server = '127.0.0.1' if server == 'localhost'
17
- if IPAddress.valid? server
18
- @server = server
19
- bind(server, port, method(:new_connection))
20
- listen(1024)
21
- else
22
- raise ArgumentError, "Invalid server address #{server}"
23
- end
24
- end
25
- end
26
-
27
-
28
- private
29
-
30
-
31
- def new_connection(client)
32
- # prevent buffering
33
- client.enable_nodelay
34
-
35
- # create the connection class
36
- c = @klass.new(client)
37
- c.post_init *@args
38
-
39
- # start read after post init and call connected
40
- client.start_read
41
- c.on_connect(client)
42
- end
43
- end
44
- end
1
+ # frozen_string_literal: true
2
+
3
+ module UV
4
+ class TcpServer < ::Libuv::TCP
5
+ def initialize(reactor, server, port, klass, *args)
6
+ super(reactor)
7
+
8
+ @klass = klass
9
+ @args = args
10
+
11
+ if server == port && port.is_a?(Integer)
12
+ # We are opening a socket descriptor
13
+ open(server)
14
+ else
15
+ # Perform basic checks before attempting to bind address
16
+ server = '127.0.0.1' if server == 'localhost'
17
+ if IPAddress.valid? server
18
+ @server = server
19
+ bind(server, port, method(:new_connection))
20
+ listen(1024)
21
+ else
22
+ raise ArgumentError, "Invalid server address #{server}"
23
+ end
24
+ end
25
+ end
26
+
27
+
28
+ private
29
+
30
+
31
+ def new_connection(client)
32
+ # prevent buffering
33
+ client.enable_nodelay
34
+
35
+ # create the connection class
36
+ c = @klass.new(client)
37
+ c.post_init *@args
38
+
39
+ # start read after post init and call connected
40
+ client.start_read
41
+ c.on_connect(client)
42
+ end
43
+ end
44
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module UV
4
- VERSION = '2.3.0'
4
+ VERSION = '2.3.1'
5
5
  end
@@ -95,7 +95,7 @@ describe UV::Scheduler do
95
95
  @reactor.stop
96
96
  end
97
97
 
98
- @scheduled, @schedules = @scheduler.instance_eval {
98
+ @scheduled, @schedules = @scheduler.instance_eval {
99
99
  [@scheduled, @schedules]
100
100
  }
101
101
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uv-rays
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen von Takach
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-12 00:00:00.000000000 Z
11
+ date: 2017-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: libuv