]> Cypherpunks.ru repositories - govpn.git/blobdiff - src/cypherpunks.ru/govpn/client/client.go
Use convenient simpler Go 1.9's sync.Map
[govpn.git] / src / cypherpunks.ru / govpn / client / client.go
index 8102cc6cdf1430217a27052526496b8c8af446a4..3014bdfab6adf0bf9276d6e31a7575286917791b 100644 (file)
@@ -23,6 +23,7 @@ import (
        "fmt"
        "net"
        "os"
+       "sync"
        "time"
 
        "github.com/agl/ed25519"
@@ -72,7 +73,7 @@ func (c *Configuration) isProxy() bool {
 type Client struct {
        idsCache      *govpn.MACCache
        tap           *govpn.TAP
-       knownPeers    govpn.KnownPeers
+       knownPeers    sync.Map
        statsPort     net.Listener
        timeouted     chan struct{}
        rehandshaking chan struct{}
@@ -99,7 +100,6 @@ func (c *Client) MainCycle() {
                        c.Error <- fmt.Errorf("Can't listen on stats port: %s", err.Error())
                        return
                }
-               c.knownPeers = govpn.KnownPeers(make(map[string]**govpn.Peer))
                go govpn.StatsProcessor(c.statsPort, &c.knownPeers)
        }