nonnative 3.2.0 → 3.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.circleci/config.yml +2 -2
- data/Gemfile.lock +1 -1
- data/lib/nonnative/fault_injection_proxy.rb +25 -20
- data/lib/nonnative/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 522cec08aee3855943f6ef6ba38bec3d85acd00aeeb2d6640a6869cf55014518
|
|
4
|
+
data.tar.gz: ebebc8d342a2111f8fb8538c0bf5b615c549b61127761c3e2ada47397294b47c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e4df243398b167fb955324fe12894f8bb5ecaf4ec612f8c55ad73e6cf95d6e04868ad1ee2ff64c1fbbc68322ea96dc953a0329b01f609a31b5409fb38542f09a
|
|
7
|
+
data.tar.gz: 419ca92810588c41e281cd4d77e49651bee8c412d7285689f196c176473364f1562eabbe1944a121e238e79c9cfb0de6335bbcde05b6e068478c45db4414cef2
|
data/.circleci/config.yml
CHANGED
|
@@ -35,7 +35,7 @@ jobs:
|
|
|
35
35
|
resource_class: arm.large
|
|
36
36
|
sync:
|
|
37
37
|
docker:
|
|
38
|
-
- image: alexfalkowski/release:8.
|
|
38
|
+
- image: alexfalkowski/release:8.15
|
|
39
39
|
working_directory: ~/nonnative
|
|
40
40
|
steps:
|
|
41
41
|
- checkout:
|
|
@@ -46,7 +46,7 @@ jobs:
|
|
|
46
46
|
resource_class: arm.large
|
|
47
47
|
version:
|
|
48
48
|
docker:
|
|
49
|
-
- image: alexfalkowski/release:8.
|
|
49
|
+
- image: alexfalkowski/release:8.15
|
|
50
50
|
working_directory: ~/nonnative
|
|
51
51
|
steps:
|
|
52
52
|
- checkout:
|
data/Gemfile.lock
CHANGED
|
@@ -77,18 +77,17 @@ module Nonnative
|
|
|
77
77
|
#
|
|
78
78
|
# @return [void]
|
|
79
79
|
def stop
|
|
80
|
-
|
|
81
|
-
close_connections
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
server = @tcp_server
|
|
85
|
-
@tcp_server = nil
|
|
80
|
+
server = tcp_server
|
|
86
81
|
server&.close
|
|
87
82
|
|
|
88
|
-
listener_thread =
|
|
89
|
-
@thread = nil
|
|
83
|
+
listener_thread = thread
|
|
90
84
|
listener_thread&.join
|
|
91
85
|
|
|
86
|
+
@tcp_server = nil
|
|
87
|
+
@thread = nil
|
|
88
|
+
|
|
89
|
+
close_connections
|
|
90
|
+
|
|
92
91
|
Nonnative.logger.info "stopped with host '#{service.host}' and port '#{service.port}' for proxy 'fault_injection'"
|
|
93
92
|
end
|
|
94
93
|
|
|
@@ -162,7 +161,7 @@ module Nonnative
|
|
|
162
161
|
logger.info "handled connection for '#{id}' with socket '#{socket.inspect}'"
|
|
163
162
|
end
|
|
164
163
|
|
|
165
|
-
|
|
164
|
+
delete_connection(id)
|
|
166
165
|
end
|
|
167
166
|
|
|
168
167
|
def connect(id, socket)
|
|
@@ -179,24 +178,26 @@ module Nonnative
|
|
|
179
178
|
end
|
|
180
179
|
|
|
181
180
|
def close_connections
|
|
182
|
-
|
|
181
|
+
active_connections = mutex.synchronize do
|
|
182
|
+
connections.to_a.tap { connections.clear }
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
active_connections.each do |id, connection|
|
|
183
186
|
close_connection(id, connection)
|
|
184
187
|
end
|
|
185
|
-
ensure
|
|
186
|
-
connections.clear
|
|
187
188
|
end
|
|
188
189
|
|
|
189
190
|
def apply_state(state)
|
|
190
|
-
|
|
191
|
-
Nonnative.logger.info "applying state '#{state}' for proxy 'fault_injection'"
|
|
191
|
+
Nonnative.logger.info "applying state '#{state}' for proxy 'fault_injection'"
|
|
192
192
|
|
|
193
|
+
mutex.synchronize do
|
|
193
194
|
return if @state == state
|
|
194
195
|
|
|
195
196
|
@state = state
|
|
196
|
-
close_connections
|
|
197
|
-
|
|
198
|
-
wait
|
|
199
197
|
end
|
|
198
|
+
|
|
199
|
+
close_connections
|
|
200
|
+
wait
|
|
200
201
|
end
|
|
201
202
|
|
|
202
203
|
def read_state
|
|
@@ -204,15 +205,19 @@ module Nonnative
|
|
|
204
205
|
end
|
|
205
206
|
|
|
206
207
|
def register_connection(id, socket)
|
|
207
|
-
connections[id] = Connection.new(socket)
|
|
208
|
+
mutex.synchronize { connections[id] = Connection.new(socket) }
|
|
208
209
|
end
|
|
209
210
|
|
|
210
211
|
def attach_connection_thread(id, thread)
|
|
211
|
-
connections[id]&.thread = thread
|
|
212
|
+
mutex.synchronize { connections[id]&.thread = thread }
|
|
212
213
|
end
|
|
213
214
|
|
|
214
215
|
def attach_connection_pair(id, pair)
|
|
215
|
-
connections[id]&.pair = pair
|
|
216
|
+
mutex.synchronize { connections[id]&.pair = pair }
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
def delete_connection(id)
|
|
220
|
+
mutex.synchronize { connections.delete(id) }
|
|
216
221
|
end
|
|
217
222
|
|
|
218
223
|
def close_connection(id, connection)
|
data/lib/nonnative/version.rb
CHANGED