Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
galene
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
galene
Commits
a78fb6d7
Commit
a78fb6d7
authored
Jul 29, 2021
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Increase file descriptor limit at startup.
parent
82b10b2c
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
62 additions
and
1 deletion
+62
-1
galene.go
galene.go
+8
-0
go.mod
go.mod
+1
-0
go.sum
go.sum
+2
-1
limit/limit.go
limit/limit.go
+7
-0
limit/limit_unix.go
limit/limit_unix.go
+44
-0
No files found.
galene.go
View file @
a78fb6d7
...
...
@@ -15,6 +15,7 @@ import (
"github.com/jech/galene/diskwriter"
"github.com/jech/galene/group"
"github.com/jech/galene/ice"
"github.com/jech/galene/limit"
"github.com/jech/galene/turnserver"
"github.com/jech/galene/webserver"
)
...
...
@@ -104,6 +105,13 @@ func main() {
}()
}
n
,
err
:=
limit
.
Nofile
(
0xFFFF
)
if
err
!=
nil
{
log
.
Printf
(
"Couldn't set file descriptor limit: %v"
,
err
)
}
else
if
n
<
0xFFFF
{
log
.
Printf
(
"File descriptor limit is %v, please increase it!"
,
n
)
}
ice
.
ICEFilename
=
filepath
.
Join
(
dataDir
,
"ice-servers.json"
)
go
group
.
ReadPublicGroups
()
...
...
go.mod
View file @
a78fb6d7
...
...
@@ -13,4 +13,5 @@ require (
github.com/pion/turn/v2 v2.0.5
github.com/pion/webrtc/v3 v3.0.31
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c
)
go.sum
View file @
a78fb6d7
...
...
@@ -122,8 +122,9 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 h1:SrN+KX8Art/Sf4HNj6Zcz06G7VEz+7w9tdXTPOZ7+l4=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c h1:F1jZWGFhYfh0Ci55sIpILtKKK8p3i2/krTr0H1rg74I=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
...
...
limit/limit.go
0 → 100644
View file @
a78fb6d7
// +build windows plan9
package
limit
func
Nofile
(
desired
uint64
)
(
uint64
,
error
)
{
return
desired
,
nil
}
limit/limit_unix.go
0 → 100644
View file @
a78fb6d7
// +build !windows
// +build !plan9
package
limit
import
(
"golang.org/x/sys/unix"
)
func
Nofile
(
desired
uint64
)
(
uint64
,
error
)
{
var
old
unix
.
Rlimit
err
:=
unix
.
Getrlimit
(
unix
.
RLIMIT_NOFILE
,
&
old
)
if
err
!=
nil
{
return
0
,
err
}
if
old
.
Cur
>=
desired
{
return
old
.
Cur
,
nil
}
if
old
.
Max
<
desired
{
limit
:=
unix
.
Rlimit
{
Cur
:
desired
,
Max
:
desired
,
}
err
:=
unix
.
Setrlimit
(
unix
.
RLIMIT_NOFILE
,
&
limit
)
if
err
==
nil
{
return
limit
.
Cur
,
nil
}
desired
=
old
.
Max
}
limit
:=
unix
.
Rlimit
{
Cur
:
desired
,
Max
:
old
.
Max
,
}
err
=
unix
.
Setrlimit
(
unix
.
RLIMIT_NOFILE
,
&
limit
)
if
err
!=
nil
{
return
old
.
Cur
,
err
}
return
limit
.
Cur
,
nil
}
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