mirror of
https://github.com/netbirdio/ice.git
synced 2026-05-22 17:10:58 -07:00
Move atomicError type into internal package
Move atomicError type into internal package
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
atomicx "github.com/pion/ice/v2/internal/atomic"
|
||||
"github.com/pion/logging"
|
||||
"github.com/pion/mdns"
|
||||
"github.com/pion/stun"
|
||||
@@ -114,7 +115,7 @@ type Agent struct {
|
||||
// State for closing
|
||||
done chan struct{}
|
||||
taskLoopDone chan struct{}
|
||||
err atomicError
|
||||
err atomicx.Error
|
||||
|
||||
gatherCandidateCancel func()
|
||||
gatherCandidateDone chan struct{}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
// Package atomic contains custom atomic types
|
||||
package atomic
|
||||
|
||||
import "sync/atomic"
|
||||
|
||||
// Error is an atomic error
|
||||
type Error struct {
|
||||
v atomic.Value
|
||||
}
|
||||
|
||||
// Store updates the value of the atomic variable
|
||||
func (a *Error) Store(err error) {
|
||||
a.v.Store(struct{ error }{err})
|
||||
}
|
||||
|
||||
// Load retrieves the current value of the atomic variable
|
||||
func (a *Error) Load() error {
|
||||
err, _ := a.v.Load().(struct{ error })
|
||||
return err.error
|
||||
}
|
||||
@@ -3,7 +3,6 @@ package ice
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/pion/logging"
|
||||
@@ -11,17 +10,6 @@ import (
|
||||
"github.com/pion/transport/v2"
|
||||
)
|
||||
|
||||
type atomicError struct{ v atomic.Value }
|
||||
|
||||
func (a *atomicError) Store(err error) {
|
||||
a.v.Store(struct{ error }{err})
|
||||
}
|
||||
|
||||
func (a *atomicError) Load() error {
|
||||
err, _ := a.v.Load().(struct{ error })
|
||||
return err.error
|
||||
}
|
||||
|
||||
// The conditions of invalidation written below are defined in
|
||||
// https://tools.ietf.org/html/rfc8445#section-5.1.1.1
|
||||
func isSupportedIPv6(ip net.IP) bool {
|
||||
|
||||
Reference in New Issue
Block a user