mirror of
https://github.com/libp2p/go-reuseport.git
synced 2025-09-27 03:05:57 +08:00
@@ -2,14 +2,7 @@ package singlepoll
|
||||
|
||||
import "context"
|
||||
|
||||
var (
|
||||
backgroundctx context.Context
|
||||
backgroundcancel context.CancelFunc
|
||||
)
|
||||
|
||||
func init() {
|
||||
backgroundctx, backgroundcancel = context.WithCancel(context.Background())
|
||||
}
|
||||
var backgroundctx, backgroundcancel = context.WithCancel(context.Background())
|
||||
|
||||
func CloseBackgroundProcesses() {
|
||||
backgroundcancel()
|
||||
|
@@ -26,8 +26,8 @@ func main() {
|
||||
a3, err := resolve.ResolveAddr("dial", "tcp", "127.0.0.1:33333")
|
||||
maybeDie(err)
|
||||
|
||||
d1 := reuse.Dialer{net.Dialer{LocalAddr: a1}}
|
||||
d2 := reuse.Dialer{net.Dialer{LocalAddr: a3}}
|
||||
d1 := reuse.Dialer{D: net.Dialer{LocalAddr: a1}}
|
||||
d2 := reuse.Dialer{D: net.Dialer{LocalAddr: a3}}
|
||||
|
||||
go func() {
|
||||
l2to1foo, err := l2.Accept()
|
||||
|
Reference in New Issue
Block a user