apiotics 0.1.101 → 0.1.102
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/apiotics/server.rb +27 -23
- data/lib/apiotics/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1841f2525d6e65a624ab64e4691093eeafc93bef
|
4
|
+
data.tar.gz: b83cee88a34a3f06c5a2b724f39449b9412b5d61
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ae737bc4a7b75f7dcc8e51272a5d908eb43420bf36f47279fb6439249ee904e6dc0fa06e725439c061a8cf1997ea0b59366303acb2079a6060e539acedb4446
|
7
|
+
data.tar.gz: 118731ec9155b8e46fcf149b44bb3108652bdbde5ee93dff6473cae0efdf438bb30855377022f7cba06c05b7c70094618340d839cb512aa81ceaafd87dd34981
|
data/lib/apiotics/server.rb
CHANGED
@@ -118,31 +118,35 @@ module Apiotics
|
|
118
118
|
|
119
119
|
def listen_local
|
120
120
|
if Apiotics.configuration.redis_comms_connection == false
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
121
|
+
begin
|
122
|
+
server = TCPServer.open(@localport)
|
123
|
+
loop do
|
124
|
+
Thread.abort_on_exception = true
|
125
|
+
Thread.fork(server.accept) do |client|
|
126
|
+
s = client.gets
|
127
|
+
if @error_msg != nil
|
128
|
+
string = '{"error":"' + error_msg + '"}'
|
129
|
+
client.puts(string)
|
130
|
+
end
|
131
|
+
#puts s
|
132
|
+
self.send(s)
|
133
|
+
end
|
134
|
+
end
|
135
|
+
else
|
136
|
+
redis = ::Redis.new
|
137
|
+
redis.subscribe(Apiotics.configuration.public_key) do |on|
|
138
|
+
on.message do |channel, msg|
|
139
|
+
if @error_msg != nil
|
140
|
+
string = '{"error":"' + error_msg + '"}'
|
141
|
+
client.puts(string)
|
142
|
+
end
|
143
|
+
#puts msg
|
144
|
+
self.send(msg)
|
145
|
+
end
|
144
146
|
end
|
145
147
|
end
|
148
|
+
rescue
|
149
|
+
server.close
|
146
150
|
end
|
147
151
|
end
|
148
152
|
|
data/lib/apiotics/version.rb
CHANGED