libuv 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/libuv/error.rb +4 -3
- data/lib/libuv/ext/platform/windows.rb +1 -2
- data/lib/libuv/version.rb +1 -1
- data/spec/udp_spec.rb +74 -0
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: abd50822e358932d098affc895bbb2140f49769f
|
4
|
+
data.tar.gz: 27fc81ccc78e0feb4e2832d92089e93444c95f0b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ac195af2e4184164bb56fc5fb5d7155bbcd61c0b995f2d601f3e194257a41366e22f1f34d5425a119537e1def895caf19f4ce9fa98a8117c6be85b4131aec74
|
7
|
+
data.tar.gz: 9be5705fb74dc2726be9360a002d47343556f0ebce42cf78686ae606fdd4837b7c94d2c37daaab9f6eaf2a50f91e70eb057cbafe55c5237393b60ab536774f72
|
data/lib/libuv/error.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
module Libuv
|
2
2
|
class Error < StandardError
|
3
|
+
class E2BIG < Error; end
|
3
4
|
class EACCES < Error; end
|
4
5
|
class EADDRINUSE < Error; end
|
5
6
|
class EADDRNOTAVAIL < Error; end
|
@@ -19,7 +20,6 @@ module Libuv
|
|
19
20
|
class EAI_PROTOCOL < Error; end
|
20
21
|
class EAI_SERVICE < Error; end
|
21
22
|
class EAI_SOCKTYPE < Error; end
|
22
|
-
class EAI_SYSTEM < Error; end
|
23
23
|
class EALREADY < Error; end
|
24
24
|
class EBADF < Error; end
|
25
25
|
class EBUSY < Error; end
|
@@ -64,8 +64,6 @@ module Libuv
|
|
64
64
|
class EPROTONOSUPPORT < Error; end
|
65
65
|
class EPROTOTYPE < Error; end
|
66
66
|
class ERANGE < Error; end
|
67
|
-
class ENXIO < Error; end
|
68
|
-
class EMLINK < Error; end
|
69
67
|
class EROFS < Error; end
|
70
68
|
class ESHUTDOWN < Error; end
|
71
69
|
class ESPIPE < Error; end
|
@@ -75,5 +73,8 @@ module Libuv
|
|
75
73
|
class EXDEV < Error; end
|
76
74
|
class UNKNOWN < Error; end
|
77
75
|
class EOF < Error; end
|
76
|
+
class ENXIO < Error; end
|
77
|
+
class EMLINK < Error; end
|
78
|
+
class EHOSTDOWN < Error; end
|
78
79
|
end
|
79
80
|
end
|
data/lib/libuv/version.rb
CHANGED
data/spec/udp_spec.rb
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'libuv'
|
2
|
+
require 'thread'
|
3
|
+
|
4
|
+
|
5
|
+
describe Libuv::UDP do
|
6
|
+
before :each do
|
7
|
+
@log = []
|
8
|
+
@general_failure = []
|
9
|
+
|
10
|
+
@loop = Libuv::Loop.new
|
11
|
+
@server = @loop.udp
|
12
|
+
@client = @loop.udp
|
13
|
+
@timeout = @loop.timer do
|
14
|
+
@loop.stop
|
15
|
+
@general_failure << "test timed out"
|
16
|
+
end
|
17
|
+
@timeout.start(5000)
|
18
|
+
|
19
|
+
@loop.all(@server, @client, @timeout).catch do |reason|
|
20
|
+
@general_failure << reason.inspect
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe 'basic client server' do
|
25
|
+
it "should send a ping and return a pong", :network => true do
|
26
|
+
@loop.run { |logger|
|
27
|
+
logger.progress do |level, errorid, error|
|
28
|
+
begin
|
29
|
+
@general_failure << "Log called: #{level}: #{errorid}\n#{error.message}\n#{error.backtrace.join("\n") if error.backtrace}\n"
|
30
|
+
rescue Exception => e
|
31
|
+
@general_failure << "error in logger #{e.inspect}"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
@server.bind('127.0.0.1', 34567)
|
37
|
+
@server.progress do |data, ip, port, server|
|
38
|
+
@log << data
|
39
|
+
server.send(ip, port, 'pong')
|
40
|
+
end
|
41
|
+
@server.start_read
|
42
|
+
|
43
|
+
# catch errors
|
44
|
+
@server.catch do |reason|
|
45
|
+
@general_failure << reason.inspect
|
46
|
+
end
|
47
|
+
|
48
|
+
|
49
|
+
# connect client to server
|
50
|
+
@client.bind('127.0.0.1', 34568)
|
51
|
+
@client.progress do |data, ip, port, client|
|
52
|
+
@log << data
|
53
|
+
client.close
|
54
|
+
end
|
55
|
+
@client.start_read
|
56
|
+
@client.send('127.0.0.1', 34567, 'ping')
|
57
|
+
|
58
|
+
# catch errors
|
59
|
+
@client.catch do |reason|
|
60
|
+
@general_failure << reason.inspect
|
61
|
+
end
|
62
|
+
|
63
|
+
# close the handle
|
64
|
+
@client.finally do
|
65
|
+
@server.close
|
66
|
+
@loop.stop
|
67
|
+
end
|
68
|
+
}
|
69
|
+
|
70
|
+
expect(@log).to eq(['ping', 'pong'])
|
71
|
+
expect(@general_failure).to eq([])
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: libuv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bulat Shakirzyanov
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-02-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ffi
|
@@ -193,7 +193,6 @@ files:
|
|
193
193
|
- ext/libuv/libuv.pc.in
|
194
194
|
- ext/libuv/m4/.gitignore
|
195
195
|
- ext/libuv/m4/as_case.m4
|
196
|
-
- ext/libuv/m4/dtrace.m4
|
197
196
|
- ext/libuv/m4/libuv-check-flags.m4
|
198
197
|
- ext/libuv/samples/.gitignore
|
199
198
|
- ext/libuv/samples/socks5-proxy/.gitignore
|
@@ -477,6 +476,7 @@ files:
|
|
477
476
|
- spec/idle_spec.rb
|
478
477
|
- spec/pipe_spec.rb
|
479
478
|
- spec/tcp_spec.rb
|
479
|
+
- spec/udp_spec.rb
|
480
480
|
homepage: https://github.com/cotag/libuv
|
481
481
|
licenses:
|
482
482
|
- MIT
|
@@ -497,7 +497,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
497
497
|
version: '0'
|
498
498
|
requirements: []
|
499
499
|
rubyforge_project:
|
500
|
-
rubygems_version: 2.
|
500
|
+
rubygems_version: 2.4.5
|
501
501
|
signing_key:
|
502
502
|
specification_version: 4
|
503
503
|
summary: libuv bindings for Ruby
|
@@ -511,4 +511,5 @@ test_files:
|
|
511
511
|
- spec/idle_spec.rb
|
512
512
|
- spec/pipe_spec.rb
|
513
513
|
- spec/tcp_spec.rb
|
514
|
+
- spec/udp_spec.rb
|
514
515
|
has_rdoc:
|