Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
c0d6224f
Commit
c0d6224f
authored
Oct 24, 2017
by
Jeromy Johnson
Committed by
GitHub
Oct 24, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4324 from ipfs/feat/default-connmgr
default settings for the connection manager
parents
fda7dd18
e49d9d91
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
1 deletion
+25
-1
core/core.go
core/core.go
+4
-1
repo/config/init.go
repo/config/init.go
+21
-0
No files found.
core/core.go
View file @
c0d6224f
...
...
@@ -271,7 +271,10 @@ func (n *IpfsNode) startOnlineServices(ctx context.Context, routingOption Routin
func
constructConnMgr
(
cfg
config
.
ConnMgr
)
(
ifconnmgr
.
ConnManager
,
error
)
{
switch
cfg
.
Type
{
case
""
,
"none"
:
case
""
:
// 'default' value is the basic connection manager
return
connmgr
.
NewConnManager
(
config
.
DefaultConnMgrLowWater
,
config
.
DefaultConnMgrHighWater
,
config
.
DefaultConnMgrGracePeriod
),
nil
case
"none"
:
return
nil
,
nil
case
"basic"
:
grace
,
err
:=
time
.
ParseDuration
(
cfg
.
GracePeriod
)
...
...
repo/config/init.go
View file @
c0d6224f
...
...
@@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"io"
"time"
peer
"gx/ipfs/QmXYjuNuxVzXKJCfWasQk1RqkhVLDM9jtUKhqc2WPQmFSB/go-libp2p-peer"
ci
"gx/ipfs/QmaPbCnUMBohSGo3KnxEa2bHqyJVVeEEcwtqJAYxerieBo/go-libp2p-crypto"
...
...
@@ -71,11 +72,31 @@ func Init(out io.Writer, nBitsForKeypair int) (*Config, error) {
Interval
:
"12h"
,
Strategy
:
"all"
,
},
Swarm
:
SwarmConfig
{
ConnMgr
:
ConnMgr
{
LowWater
:
DefaultConnMgrLowWater
,
HighWater
:
DefaultConnMgrHighWater
,
GracePeriod
:
DefaultConnMgrGracePeriod
.
String
(),
Type
:
"basic"
,
},
},
}
return
conf
,
nil
}
// DefaultConnMgrHighWater is the default value for the connection managers
// 'high water' mark
const
DefaultConnMgrHighWater
=
900
// DefaultConnMgrLowWater is the default value for the connection managers 'low
// water' mark
const
DefaultConnMgrLowWater
=
600
// DefaultConnMgrGracePeriod is the default value for the connection managers
// grace period
const
DefaultConnMgrGracePeriod
=
time
.
Second
*
20
// DefaultDatastoreConfig is an internal function exported to aid in testing.
func
DefaultDatastoreConfig
()
Datastore
{
return
Datastore
{
...
...
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