]> Cypherpunks.ru repositories - govpn.git/blobdiff - src/govpn/peer.go
Simple optimization for TCP buffer check
[govpn.git] / src / govpn / peer.go
index 5c6e13bf945e9af39bff79754df79565d01d7e0a..e666b4755a55c298d51985d22d3e9fc9b4f31cb1 100644 (file)
@@ -24,6 +24,8 @@ const (
        PktSizeSize = 2
        // Heartbeat rate, relative to Timeout
        TimeoutHeartbeat = 4
+       // Minimal valid packet length: 2+
+       MinPktLength = 2 + 16 + 8
 )
 
 func newNonceCipher(key *[32]byte) *xtea.Cipher {
@@ -84,14 +86,14 @@ type Peer struct {
        HeartbeatSent   int
 
        // Receiver
-       BusyR    sync.Mutex
+       BusyR    sync.Mutex `json:"-"`
        bufR     []byte
        tagR     *[TagSize]byte
        keyAuthR *[SSize]byte
        pktSizeR uint16
 
        // Transmitter
-       BusyT    sync.Mutex
+       BusyT    sync.Mutex `json:"-"`
        bufT     []byte
        tagT     *[TagSize]byte
        keyAuthT *[SSize]byte