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
p2p
go-socket-activation
Commits
935f8a53
Unverified
Commit
935f8a53
authored
May 19, 2021
by
Marten Seemann
Committed by
GitHub
May 19, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #13 from libp2p/fix-staticcheck
fix staticcheck
parents
54a6b11d
9365a29d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
2 deletions
+3
-2
sockets.go
sockets.go
+0
-2
sockets_linux.go
sockets_linux.go
+3
-0
No files found.
sockets.go
View file @
935f8a53
...
@@ -3,13 +3,11 @@ package sockets
...
@@ -3,13 +3,11 @@ package sockets
import
(
import
(
"sync"
"sync"
logging
"github.com/ipfs/go-log"
manet
"github.com/multiformats/go-multiaddr-net"
manet
"github.com/multiformats/go-multiaddr-net"
)
)
var
(
var
(
mu
sync
.
Mutex
mu
sync
.
Mutex
log
=
logging
.
Logger
(
"socket-activation"
)
initFn
=
func
()
{}
initFn
=
func
()
{}
initialized
=
false
initialized
=
false
listeners
=
make
(
map
[
string
][]
manet
.
Listener
)
listeners
=
make
(
map
[
string
][]
manet
.
Listener
)
...
...
sockets_linux.go
View file @
935f8a53
...
@@ -9,9 +9,12 @@ import (
...
@@ -9,9 +9,12 @@ import (
"syscall"
"syscall"
activation
"github.com/coreos/go-systemd/v22/activation"
activation
"github.com/coreos/go-systemd/v22/activation"
logging
"github.com/ipfs/go-log"
manet
"github.com/multiformats/go-multiaddr-net"
manet
"github.com/multiformats/go-multiaddr-net"
)
)
var
log
=
logging
.
Logger
(
"socket-activation"
)
func
isListening
(
file
*
os
.
File
)
(
bool
,
error
)
{
func
isListening
(
file
*
os
.
File
)
(
bool
,
error
)
{
ret
,
err
:=
syscall
.
GetsockoptInt
(
int
(
file
.
Fd
()),
syscall
.
SOL_SOCKET
,
syscall
.
SO_ACCEPTCONN
)
ret
,
err
:=
syscall
.
GetsockoptInt
(
int
(
file
.
Fd
()),
syscall
.
SOL_SOCKET
,
syscall
.
SO_ACCEPTCONN
)
return
ret
==
1
,
err
return
ret
==
1
,
err
...
...
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