]> Cypherpunks.ru repositories - govpn.git/blobdiff - src/cypherpunks.ru/govpn/cmd/govpn-server/tcp.go
Raise copyright years
[govpn.git] / src / cypherpunks.ru / govpn / cmd / govpn-server / tcp.go
index 66b934504b842e17c65751a5f53117b738eabe48..ad7bcc6a02bde0f9b3ba2ea48e3f9a6a7b90cf8c 100644 (file)
@@ -1,6 +1,6 @@
 /*
 GoVPN -- simple secure free software virtual private network daemon
-Copyright (C) 2014-2016 Sergey Matveev <stargrave@stargrave.org>
+Copyright (C) 2014-2017 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -108,7 +108,7 @@ func handleTCP(conn net.Conn) {
                                tap:        tap,
                                terminator: make(chan struct{}),
                        }
-                       go peerReady(*ps)
+                       go govpn.PeerTapProcessor(ps.peer, ps.tap, ps.terminator)
                        peersByIdLock.Lock()
                        kpLock.Lock()
                        delete(peers, addrPrev)
@@ -143,7 +143,7 @@ func handleTCP(conn net.Conn) {
                                tap:        tap,
                                terminator: make(chan struct{}, 1),
                        }
-                       go peerReady(*ps)
+                       go govpn.PeerTapProcessor(ps.peer, ps.tap, ps.terminator)
                        peersLock.Lock()
                        peersByIdLock.Lock()
                        kpLock.Lock()
@@ -164,8 +164,6 @@ func handleTCP(conn net.Conn) {
                return
        }
 
-       nonceExpectation := make([]byte, govpn.NonceSize)
-       peer.NonceExpectation(nonceExpectation)
        prev = 0
        var i int
        for {
@@ -183,7 +181,7 @@ func handleTCP(conn net.Conn) {
                if prev < govpn.MinPktLength {
                        continue
                }
-               i = bytes.Index(buf[:prev], nonceExpectation)
+               i = bytes.Index(buf[:prev], peer.NonceExpect)
                if i == -1 {
                        continue
                }
@@ -194,7 +192,6 @@ func handleTCP(conn net.Conn) {
                        )
                        break
                }
-               peer.NonceExpectation(nonceExpectation)
                copy(buf, buf[i+govpn.NonceSize:prev])
                prev = prev - i - govpn.NonceSize
                goto CheckMore