jsonrpc2.0-tcp 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/jsonrpc2.0-tcp.gemspec +1 -1
- data/lib/jsonrpc2.0-tcp/ConnectionThread.rb +0 -12
- data/lib/jsonrpc2.0-tcp/Server.rb +3 -9
- metadata +4 -4
data/jsonrpc2.0-tcp.gemspec
CHANGED
@@ -1,16 +1,4 @@
|
|
1
1
|
class ConnectionThread < Thread
|
2
|
-
attr_accessor :loginMethod, :timeout
|
3
|
-
attr_reader :restrict
|
4
|
-
|
5
|
-
def loginMethod=(method)
|
6
|
-
@loginMethod = method
|
7
|
-
@restrict = method
|
8
|
-
end
|
9
|
-
|
10
|
-
def login
|
11
|
-
@restrict = nil
|
12
|
-
end
|
13
|
-
|
14
2
|
def start_timeout(timeout)
|
15
3
|
@timeoutThread.exit unless @timeoutThread == nil
|
16
4
|
|
@@ -3,9 +3,8 @@ require 'jsonrpc2.0/server'
|
|
3
3
|
require_relative './ConnectionThread.rb'
|
4
4
|
|
5
5
|
class JsonRpcTcpServer < JsonRpcServer
|
6
|
-
def initialize(port,
|
7
|
-
@
|
8
|
-
@shutdownTimeout = opts['shutdownTimeout']
|
6
|
+
def initialize(port, shutdownTimeout)
|
7
|
+
@shutdownTimeout = shutdownTimeout
|
9
8
|
|
10
9
|
@server = TCPServer.new('localhost', port)
|
11
10
|
@runLoop = nil
|
@@ -20,11 +19,10 @@ class JsonRpcTcpServer < JsonRpcServer
|
|
20
19
|
loop do
|
21
20
|
thr = ConnectionThread.start(@server.accept) do |conn|
|
22
21
|
selfThread = Thread.current
|
23
|
-
selfThread.loginMethod = @loginMethod
|
24
22
|
|
25
23
|
while @runLoop != nil and (message = conn.gets) != nil
|
26
24
|
selfThread.stop_timeout
|
27
|
-
conn.puts handle_message(message
|
25
|
+
conn.puts handle_message(message)
|
28
26
|
end
|
29
27
|
|
30
28
|
conn.close
|
@@ -44,10 +42,6 @@ class JsonRpcTcpServer < JsonRpcServer
|
|
44
42
|
end
|
45
43
|
end
|
46
44
|
|
47
|
-
def login
|
48
|
-
Thread.current.login
|
49
|
-
end
|
50
|
-
|
51
45
|
def stop
|
52
46
|
@runLoop.exit
|
53
47
|
@runLoop = nil
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jsonrpc2.0-tcp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-06-
|
12
|
+
date: 2011-06-28 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: jsonrpc2.0
|
16
|
-
requirement: &
|
16
|
+
requirement: &2153328180 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: 0.1.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2153328180
|
25
25
|
description:
|
26
26
|
email: dev@coldsun.org
|
27
27
|
executables: []
|