Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Chiguireitor
addrindexrs
Commits
284275e2
Unverified
Commit
284275e2
authored
Jun 14, 2018
by
Roman Zeyde
Browse files
Stop and join all Electrum client threads on SIGINT
parent
165b48cc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
3 deletions
+10
-3
src/rpc.rs
src/rpc.rs
+10
-3
No files found.
src/rpc.rs
View file @
284275e2
...
...
@@ -421,19 +421,26 @@ impl RPC {
let
senders
=
Arc
::
new
(
Mutex
::
new
(
Vec
::
<
SyncSender
<
Message
>>
::
new
()));
let
acceptor
=
RPC
::
start_acceptor
(
addr
);
RPC
::
start_notifier
(
notification
,
senders
.clone
(),
acceptor
.sender
());
let
mut
children
=
vec!
[];
while
let
Some
((
stream
,
addr
))
=
acceptor
.receiver
()
.recv
()
.unwrap
()
{
let
query
=
query
.clone
();
let
senders
=
senders
.clone
();
let
stats
=
stats
.clone
();
thread
::
spawn
(
move
||
{
children
.push
(
thread
::
spawn
(
move
||
{
info!
(
"[{}] connected peer"
,
addr
);
let
conn
=
Connection
::
new
(
query
,
stream
,
addr
,
stats
);
senders
.lock
()
.unwrap
()
.push
(
conn
.chan
.sender
());
conn
.run
();
info!
(
"[{}] disconnected peer"
,
addr
);
});
}));
}
info!
(
"stopping RPC server"
);
for
sender
in
senders
.lock
()
.unwrap
()
.iter
()
{
let
_
=
sender
.send
(
Message
::
Done
);
}
for
child
in
children
{
let
_
=
child
.join
();
}
info!
(
"stopping RPC server"
)
}),
};
handle
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment