serverengine 2.2.2 → 2.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -4
- data/Changelog +4 -0
- data/lib/serverengine/socket_manager.rb +38 -1
- data/lib/serverengine/version.rb +1 -1
- data/spec/socket_manager_spec.rb +15 -1
- 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: c37776b7f6420e895262df160ce7156bf00b6c3adaccd8af016e2d35c2d49f28
|
4
|
+
data.tar.gz: 7109cb65899f1afd047c3a6ddce8dee6b51dcbf69d1c7bc0ef80937214a90850
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f92e476daba00bad71a9de2bb924187926bcc071266b510cba15741f584a3d14333d28533c9530d48f8b9820bd1fb9522bd1bfa5f3c1c858f238f44042a803cd
|
7
|
+
data.tar.gz: 0bd8378d0840b3ca89bae30999317925f9e3155d9c37fb3a9d5482c95f1be0350fa60b82c8d0706d5cdea40573f5bdf2801d4717f55b22da32469177895c15b5
|
data/.travis.yml
CHANGED
data/Changelog
CHANGED
@@ -72,7 +72,10 @@ module ServerEngine
|
|
72
72
|
class Server
|
73
73
|
def self.generate_path
|
74
74
|
if ServerEngine.windows?
|
75
|
-
|
75
|
+
port = ENV['SERVERENGINE_SOCKETMANAGER_PORT']
|
76
|
+
return port.to_i if port
|
77
|
+
|
78
|
+
for port in get_dynamic_port_range
|
76
79
|
if `netstat -na | findstr "#{port}"`.length == 0
|
77
80
|
return port
|
78
81
|
end
|
@@ -160,6 +163,40 @@ module ServerEngine
|
|
160
163
|
ensure
|
161
164
|
peer.close
|
162
165
|
end
|
166
|
+
|
167
|
+
if ServerEngine.windows?
|
168
|
+
def self.valid_dynamic_port_range(start_port, end_port)
|
169
|
+
return false if start_port < 1025 or start_port > 65535
|
170
|
+
return false if end_port < 1025 or end_port > 65535
|
171
|
+
return false if start_port > end_port
|
172
|
+
true
|
173
|
+
end
|
174
|
+
|
175
|
+
def self.get_dynamic_port_range
|
176
|
+
numbers = []
|
177
|
+
# Example output of netsh (actual output is localized):
|
178
|
+
#
|
179
|
+
# Protocol tcp Dynamic Port Range
|
180
|
+
# ---------------------------------
|
181
|
+
# Start Port : 49152
|
182
|
+
# Number of Ports : 16384
|
183
|
+
#
|
184
|
+
str = `netsh int ipv4 show dynamicport tcp`.force_encoding("ASCII-8BIT")
|
185
|
+
str.each_line { |line| numbers << $1.to_i if line.match(/.*: (\d+)/) }
|
186
|
+
|
187
|
+
start_port, n_ports = numbers[0], numbers[1]
|
188
|
+
end_port = start_port + n_ports - 1
|
189
|
+
|
190
|
+
if valid_dynamic_port_range(start_port, end_port)
|
191
|
+
return start_port..end_port
|
192
|
+
else
|
193
|
+
# The default dynamic port range is 49152 - 65535 as of Windows Vista
|
194
|
+
# and Windows Server 2008.
|
195
|
+
# https://docs.microsoft.com/en-us/troubleshoot/windows-server/networking/default-dynamic-port-range-tcpip-chang
|
196
|
+
return 49152..65535
|
197
|
+
end
|
198
|
+
end
|
199
|
+
end
|
163
200
|
end
|
164
201
|
|
165
202
|
def self.send_peer(peer, obj)
|
data/lib/serverengine/version.rb
CHANGED
data/spec/socket_manager_spec.rb
CHANGED
@@ -19,7 +19,21 @@ describe ServerEngine::SocketManager do
|
|
19
19
|
File.unlink(server_path) if server_path.is_a?(String) && File.exist?(server_path)
|
20
20
|
end
|
21
21
|
|
22
|
-
if
|
22
|
+
if ServerEngine.windows?
|
23
|
+
context 'Server.generate_path' do
|
24
|
+
it 'returns socket path as port number' do
|
25
|
+
path = SocketManager::Server.generate_path
|
26
|
+
expect(path).to be_between(49152, 65535)
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'can be changed via environment variable' do
|
30
|
+
ENV['SERVERENGINE_SOCKETMANAGER_PORT'] = '54321'
|
31
|
+
path = SocketManager::Server.generate_path
|
32
|
+
expect(path).to be 54321
|
33
|
+
ENV.delete('SERVERENGINE_SOCKETMANAGER_PORT')
|
34
|
+
end
|
35
|
+
end
|
36
|
+
else
|
23
37
|
context 'Server.generate_path' do
|
24
38
|
it 'returns socket path under /tmp' do
|
25
39
|
path = SocketManager::Server.generate_path
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: serverengine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sadayuki Furuhashi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sigdump
|
@@ -153,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
153
|
- !ruby/object:Gem::Version
|
154
154
|
version: '0'
|
155
155
|
requirements: []
|
156
|
-
rubygems_version: 3.
|
156
|
+
rubygems_version: 3.1.4
|
157
157
|
signing_key:
|
158
158
|
specification_version: 4
|
159
159
|
summary: ServerEngine - multiprocess server framework
|