json-socket 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/json-socket.rb +4 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46a865cdc1b4ab82e552adcb126791787d5fefe87d27563deeeef81b07d24dab
|
4
|
+
data.tar.gz: edf79c31433a6962db8272dbd463b0f60056c129a892b93423ac6333b8e2d169
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98c75257eb925c267d1ec530a9602d44078c4d21f7e05eafec04531f33a58118f2962aaf7bd84b0cea87b23fbc0ffac9b2c9c23382aff36b87f50d78e89f3574
|
7
|
+
data.tar.gz: 8d3f6bbc130ef056f8bc91bcdebe6784a0f2865c68fc3a6f75b5ef82891dc9839e1099dfc53ee3fefd58256ea41f8defe6989f3b0a1235ad3731ebc1674a87a3
|
data/lib/json-socket.rb
CHANGED
@@ -18,7 +18,6 @@ module JSONSocket
|
|
18
18
|
|
19
19
|
end
|
20
20
|
|
21
|
-
|
22
21
|
class Server
|
23
22
|
|
24
23
|
include JsonEncodeDecode
|
@@ -96,14 +95,16 @@ module JSONSocket
|
|
96
95
|
socket << "#{strigified.bytesize}#{@delimeter}#{strigified}"
|
97
96
|
message_length = socket.gets(@delimeter).to_i
|
98
97
|
return parse_json(socket.read(message_length))
|
98
|
+
ensure
|
99
|
+
socket.close
|
99
100
|
end
|
100
101
|
|
101
102
|
def send(message)
|
102
103
|
begin
|
103
104
|
if @unix_socket
|
104
|
-
UNIXSocket.open(@unix_socket) {|
|
105
|
+
UNIXSocket.open(@unix_socket) {|socket| handle_send_receive(socket, message) }
|
105
106
|
else
|
106
|
-
TCPSocket.open(@host, @port) {|
|
107
|
+
TCPSocket.open(@host, @port) {|socket| handle_send_receive(socket, message) }
|
107
108
|
end
|
108
109
|
rescue Exception => e
|
109
110
|
STDERR.puts e
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: json-socket
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- foi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oj
|
@@ -66,7 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
66
66
|
version: '0'
|
67
67
|
requirements: []
|
68
68
|
rubyforge_project:
|
69
|
-
rubygems_version: 2.7.
|
69
|
+
rubygems_version: 2.7.6
|
70
70
|
signing_key:
|
71
71
|
specification_version: 4
|
72
72
|
summary: json-socket protocol implementation
|