]> Sergey Matveev's repositories - btrtrc.git/blobdiff - peerconn.go
Synchronize holepunch connect messages with existing rendezvous
[btrtrc.git] / peerconn.go
index c45d87ff6d06e527f7f82a7c006014352c497d30..df792ae3053cfa6cdfa9153776a23d38d83ee5cc 100644 (file)
@@ -14,8 +14,6 @@ import (
        "strings"
        "time"
 
-       utHolepunch "github.com/anacrolix/torrent/peer_protocol/ut-holepunch"
-
        "github.com/RoaringBitmap/roaring"
        . "github.com/anacrolix/generics"
        "github.com/anacrolix/log"
@@ -28,6 +26,7 @@ import (
        "github.com/anacrolix/torrent/metainfo"
        "github.com/anacrolix/torrent/mse"
        pp "github.com/anacrolix/torrent/peer_protocol"
+       utHolepunch "github.com/anacrolix/torrent/peer_protocol/ut-holepunch"
 )
 
 // Maintains the state of a BitTorrent-protocol based connection with a peer.
@@ -891,6 +890,8 @@ func (c *PeerConn) onReadExtendedMsg(id pp.ExtensionNumber, payload []byte) (err
                        err = fmt.Errorf("unmarshalling ut_holepunch message: %w", err)
                        return
                }
+               err = c.t.handleReceivedUtHolepunchMsg(msg, c)
+               return
        default:
                return fmt.Errorf("unexpected extended message ID: %v", id)
        }