msgpack-rpc 0.4.4 → 0.4.5
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +4 -0
- data/lib/msgpack/rpc/address.rb +24 -9
- data/lib/msgpack/rpc/version.rb +1 -1
- data/test/msgpack_rpc_test.rb +8 -0
- metadata +4 -4
data/ChangeLog
CHANGED
data/lib/msgpack/rpc/address.rb
CHANGED
@@ -82,16 +82,31 @@ class Address
|
|
82
82
|
Address.parse(@serial)
|
83
83
|
end
|
84
84
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
85
|
+
if "".respond_to?(:encoding)
|
86
|
+
def self.parse_sockaddr(raw)
|
87
|
+
raw.force_encoding('ASCII-8BIT')
|
88
|
+
if raw.length == 6
|
89
|
+
addr = Socket.pack_sockaddr_in(0, '0.0.0.0')
|
90
|
+
addr[2,6] = raw[0,6]
|
91
|
+
else
|
92
|
+
addr = Socket.pack_sockaddr_in(0, '::')
|
93
|
+
addr[2,2] = raw[0,2]
|
94
|
+
addr[8,16] = raw[2,16]
|
95
|
+
end
|
96
|
+
addr
|
97
|
+
end
|
98
|
+
else
|
99
|
+
def self.parse_sockaddr(raw)
|
100
|
+
if raw.length == 6
|
101
|
+
addr = Socket.pack_sockaddr_in(0, '0.0.0.0')
|
102
|
+
addr[2,6] = raw[0,6]
|
103
|
+
else
|
104
|
+
addr = Socket.pack_sockaddr_in(0, '::')
|
105
|
+
addr[2,2] = raw[0,2]
|
106
|
+
addr[8,16] = raw[2,16]
|
107
|
+
end
|
108
|
+
addr
|
93
109
|
end
|
94
|
-
addr
|
95
110
|
end
|
96
111
|
|
97
112
|
def self.parse(raw)
|
data/lib/msgpack/rpc/version.rb
CHANGED
data/test/msgpack_rpc_test.rb
CHANGED
@@ -285,5 +285,13 @@ class MessagePackRPCTest < Test::Unit::TestCase
|
|
285
285
|
cli.close
|
286
286
|
lsock.close
|
287
287
|
end
|
288
|
+
|
289
|
+
def test_address
|
290
|
+
addr = MessagePack::RPC::Address.new('172.16.0.11', 18900)
|
291
|
+
raw = addr.to_msgpack
|
292
|
+
msg = MessagePack.unpack(raw)
|
293
|
+
addr2 = MessagePack::RPC::Address.load(msg)
|
294
|
+
assert_equal(addr, addr2)
|
295
|
+
end
|
288
296
|
end
|
289
297
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: msgpack-rpc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 5
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 5
|
10
|
+
version: 0.4.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- FURUHASHI Sadayuki
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-04-
|
18
|
+
date: 2011-04-14 00:00:00 +09:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|