mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-30 18:13:54 +08:00
hide fd adjusting code behind daemon feature flag
License: MIT Signed-off-by: Jeromy <jeromyj@gmail.com>
This commit is contained in:
@ -40,6 +40,7 @@ const (
|
|||||||
unrestrictedApiAccessKwd = "unrestricted-api"
|
unrestrictedApiAccessKwd = "unrestricted-api"
|
||||||
unencryptTransportKwd = "disable-transport-encryption"
|
unencryptTransportKwd = "disable-transport-encryption"
|
||||||
enableGCKwd = "enable-gc"
|
enableGCKwd = "enable-gc"
|
||||||
|
adjustFDLimitKwd = "manage-fdlimit"
|
||||||
// apiAddrKwd = "address-api"
|
// apiAddrKwd = "address-api"
|
||||||
// swarmAddrKwd = "address-swarm"
|
// swarmAddrKwd = "address-swarm"
|
||||||
)
|
)
|
||||||
@ -132,6 +133,7 @@ future version, along with this notice. Please move to setting the HTTP Headers.
|
|||||||
cmds.BoolOption(unrestrictedApiAccessKwd, "Allow API access to unlisted hashes"),
|
cmds.BoolOption(unrestrictedApiAccessKwd, "Allow API access to unlisted hashes"),
|
||||||
cmds.BoolOption(unencryptTransportKwd, "Disable transport encryption (for debugging protocols)"),
|
cmds.BoolOption(unencryptTransportKwd, "Disable transport encryption (for debugging protocols)"),
|
||||||
cmds.BoolOption(enableGCKwd, "Enable automatic periodic repo garbage collection"),
|
cmds.BoolOption(enableGCKwd, "Enable automatic periodic repo garbage collection"),
|
||||||
|
cmds.BoolOption(adjustFDLimitKwd, "Check and raise file descriptor limits if needed"),
|
||||||
|
|
||||||
// TODO: add way to override addresses. tricky part: updating the config if also --init.
|
// TODO: add way to override addresses. tricky part: updating the config if also --init.
|
||||||
// cmds.StringOption(apiAddrKwd, "Address for the daemon rpc API (overrides config)"),
|
// cmds.StringOption(apiAddrKwd, "Address for the daemon rpc API (overrides config)"),
|
||||||
@ -158,8 +160,11 @@ func daemonFunc(req cmds.Request, res cmds.Response) {
|
|||||||
// let the user know we're going.
|
// let the user know we're going.
|
||||||
fmt.Printf("Initializing daemon...\n")
|
fmt.Printf("Initializing daemon...\n")
|
||||||
|
|
||||||
if err := fileDescriptorCheck(); err != nil {
|
managefd, _, _ := req.Option(adjustFDLimitKwd).Bool()
|
||||||
log.Error("setting file descriptor limit: %s", err)
|
if managefd {
|
||||||
|
if err := fileDescriptorCheck(); err != nil {
|
||||||
|
log.Error("setting file descriptor limit: %s", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx := req.InvocContext()
|
ctx := req.InvocContext()
|
||||||
|
@ -9,7 +9,7 @@ import (
|
|||||||
"syscall"
|
"syscall"
|
||||||
)
|
)
|
||||||
|
|
||||||
var ipfsFileDescNum = uint64(1024)
|
var ipfsFileDescNum = uint64(2048)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
if val := os.Getenv("IPFS_FD_MAX"); val != "" {
|
if val := os.Getenv("IPFS_FD_MAX"); val != "" {
|
||||||
|
@ -13,9 +13,6 @@ test_init_ipfs
|
|||||||
|
|
||||||
test_launch_ipfs_daemon --unrestricted-api --disable-transport-encryption
|
test_launch_ipfs_daemon --unrestricted-api --disable-transport-encryption
|
||||||
|
|
||||||
test_expect_success "convert addresses from multiaddrs" '
|
|
||||||
'
|
|
||||||
|
|
||||||
gwyaddr=$GWAY_ADDR
|
gwyaddr=$GWAY_ADDR
|
||||||
apiaddr=$API_ADDR
|
apiaddr=$API_ADDR
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user