Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
duniter
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nodes
typescript
duniter
Commits
1b068778
Commit
1b068778
authored
7 years ago
by
Cédric Moreau
Browse files
Options
Downloads
Patches
Plain Diff
[fix]
#1135
Regularly try to reconnect to the WS2P network
parent
c30fcd64
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/modules/ws2p/lib/WS2PCluster.ts
+8
-0
8 additions, 0 deletions
app/modules/ws2p/lib/WS2PCluster.ts
with
8 additions
and
0 deletions
app/modules/ws2p/lib/WS2PCluster.ts
+
8
−
0
View file @
1b068778
...
...
@@ -77,6 +77,9 @@ export class WS2PCluster {
// The triggerer of a buffer of heads' sending
private
headsTimeout
:
NodeJS
.
Timer
|
null
=
null
// A timer to regularly reconnect to the network in case we are below the minimum connections' count
private
reconnectionInteval
:
NodeJS
.
Timer
|
null
=
null
private
constructor
(
private
server
:
Server
)
{
this
.
messageHandler
=
new
WS2PServerMessageHandler
(
this
.
server
,
this
)
// Conf: max private connections
...
...
@@ -622,6 +625,8 @@ export class WS2PCluster {
}
async
startCrawling
(
waitConnection
=
false
)
{
// For connectivity
this
.
reconnectionInteval
=
setInterval
(()
=>
this
.
server
.
push
({
ws2p
:
'
disconnected
'
}),
1000
*
60
*
10
)
// For blocks
if
(
this
.
syncBlockInterval
)
clearInterval
(
this
.
syncBlockInterval
);
...
...
@@ -650,6 +655,9 @@ export class WS2PCluster {
}
async
stopCrawling
()
{
if
(
this
.
reconnectionInteval
)
{
clearInterval
(
this
.
reconnectionInteval
)
}
if
(
this
.
syncBlockInterval
)
{
clearInterval
(
this
.
syncBlockInterval
)
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment