diff --git a/AUTHORS.txt b/AUTHORS.txt index ed79eeb6..619c2adf 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -10,6 +10,7 @@ Atsushi Watanabe backkem cnderrauber David Colburn +David Zhao Herman Banken Hugo Arregui Igor German diff --git a/internal/allocation/allocation.go b/internal/allocation/allocation.go index ac696ec4..644a2da1 100644 --- a/internal/allocation/allocation.go +++ b/internal/allocation/allocation.go @@ -13,6 +13,10 @@ import ( "github.com/pion/turn/v2/internal/proto" ) +const ( + allocationDeadline = 30 * time.Second +) + type allocationResponse struct { transactionID [stun.TransactionIDSize]byte responseAttrs []stun.Setter @@ -245,6 +249,7 @@ func (a *Allocation) packetHandler(m *Manager) { buffer := make([]byte, rtpMTU) for { + _ = a.RelaySocket.SetReadDeadline(time.Now().Add(allocationDeadline)) n, srcAddr, err := a.RelaySocket.ReadFrom(buffer) if err != nil { m.DeleteAllocation(a.fiveTuple)