mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Remove Stack.NewJob
Use the static method instead; these methods encourage callers to retain a pointer to the entire stack rather than only its clock which they require. PiperOrigin-RevId: 408651956
This commit is contained in:
committed by
gVisor bot
parent
84b38f4c6e
commit
3f5cfe694a
@@ -150,7 +150,7 @@ func (igmp *igmpState) init(ep *endpoint) {
|
||||
MaxUnsolicitedReportDelay: UnsolicitedReportIntervalMax,
|
||||
})
|
||||
igmp.igmpV1Present = igmpV1PresentDefault
|
||||
igmp.igmpV1Job = ep.protocol.stack.NewJob(&ep.mu, func() {
|
||||
igmp.igmpV1Job = tcpip.NewJob(ep.protocol.stack.Clock(), &ep.mu, func() {
|
||||
igmp.setV1Present(false)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -870,7 +870,7 @@ func (ndp *ndpState) handleOffLinkRouteDiscovery(route offLinkRoute, lifetime ti
|
||||
|
||||
state := offLinkRouteState{
|
||||
prf: prf,
|
||||
invalidationJob: ndp.ep.protocol.stack.NewJob(&ndp.ep.mu, func() {
|
||||
invalidationJob: tcpip.NewJob(ndp.ep.protocol.stack.Clock(), &ndp.ep.mu, func() {
|
||||
ndp.invalidateOffLinkRoute(route)
|
||||
}),
|
||||
}
|
||||
@@ -917,7 +917,7 @@ func (ndp *ndpState) rememberOnLinkPrefix(prefix tcpip.Subnet, l time.Duration)
|
||||
ndpDisp.OnOnLinkPrefixDiscovered(ndp.ep.nic.ID(), prefix)
|
||||
|
||||
state := onLinkPrefixState{
|
||||
invalidationJob: ndp.ep.protocol.stack.NewJob(&ndp.ep.mu, func() {
|
||||
invalidationJob: tcpip.NewJob(ndp.ep.protocol.stack.Clock(), &ndp.ep.mu, func() {
|
||||
ndp.invalidateOnLinkPrefix(prefix)
|
||||
}),
|
||||
}
|
||||
@@ -1062,7 +1062,7 @@ func (ndp *ndpState) doSLAAC(prefix tcpip.Subnet, pl, vl time.Duration) {
|
||||
}
|
||||
|
||||
state := slaacPrefixState{
|
||||
deprecationJob: ndp.ep.protocol.stack.NewJob(&ndp.ep.mu, func() {
|
||||
deprecationJob: tcpip.NewJob(ndp.ep.protocol.stack.Clock(), &ndp.ep.mu, func() {
|
||||
state, ok := ndp.slaacPrefixes[prefix]
|
||||
if !ok {
|
||||
panic(fmt.Sprintf("ndp: must have a slaacPrefixes entry for the deprecated SLAAC prefix %s", prefix))
|
||||
@@ -1070,7 +1070,7 @@ func (ndp *ndpState) doSLAAC(prefix tcpip.Subnet, pl, vl time.Duration) {
|
||||
|
||||
ndp.deprecateSLAACAddress(state.stableAddr.addressEndpoint)
|
||||
}),
|
||||
invalidationJob: ndp.ep.protocol.stack.NewJob(&ndp.ep.mu, func() {
|
||||
invalidationJob: tcpip.NewJob(ndp.ep.protocol.stack.Clock(), &ndp.ep.mu, func() {
|
||||
state, ok := ndp.slaacPrefixes[prefix]
|
||||
if !ok {
|
||||
panic(fmt.Sprintf("ndp: must have a slaacPrefixes entry for the invalidated SLAAC prefix %s", prefix))
|
||||
@@ -1335,7 +1335,7 @@ func (ndp *ndpState) generateTempSLAACAddr(prefix tcpip.Subnet, prefixState *sla
|
||||
}
|
||||
|
||||
state := tempSLAACAddrState{
|
||||
deprecationJob: ndp.ep.protocol.stack.NewJob(&ndp.ep.mu, func() {
|
||||
deprecationJob: tcpip.NewJob(ndp.ep.protocol.stack.Clock(), &ndp.ep.mu, func() {
|
||||
prefixState, ok := ndp.slaacPrefixes[prefix]
|
||||
if !ok {
|
||||
panic(fmt.Sprintf("ndp: must have a slaacPrefixes entry for %s to deprecate temporary address %s", prefix, generatedAddr))
|
||||
@@ -1348,7 +1348,7 @@ func (ndp *ndpState) generateTempSLAACAddr(prefix tcpip.Subnet, prefixState *sla
|
||||
|
||||
ndp.deprecateSLAACAddress(tempAddrState.addressEndpoint)
|
||||
}),
|
||||
invalidationJob: ndp.ep.protocol.stack.NewJob(&ndp.ep.mu, func() {
|
||||
invalidationJob: tcpip.NewJob(ndp.ep.protocol.stack.Clock(), &ndp.ep.mu, func() {
|
||||
prefixState, ok := ndp.slaacPrefixes[prefix]
|
||||
if !ok {
|
||||
panic(fmt.Sprintf("ndp: must have a slaacPrefixes entry for %s to invalidate temporary address %s", prefix, generatedAddr))
|
||||
@@ -1361,7 +1361,7 @@ func (ndp *ndpState) generateTempSLAACAddr(prefix tcpip.Subnet, prefixState *sla
|
||||
|
||||
ndp.invalidateTempSLAACAddr(prefixState.tempAddrs, generatedAddr.Address, tempAddrState)
|
||||
}),
|
||||
regenJob: ndp.ep.protocol.stack.NewJob(&ndp.ep.mu, func() {
|
||||
regenJob: tcpip.NewJob(ndp.ep.protocol.stack.Clock(), &ndp.ep.mu, func() {
|
||||
prefixState, ok := ndp.slaacPrefixes[prefix]
|
||||
if !ok {
|
||||
panic(fmt.Sprintf("ndp: must have a slaacPrefixes entry for %s to regenerate temporary address after %s", prefix, generatedAddr))
|
||||
|
||||
@@ -419,11 +419,6 @@ func New(opts Options) *Stack {
|
||||
return s
|
||||
}
|
||||
|
||||
// newJob returns a tcpip.Job using the Stack clock.
|
||||
func (s *Stack) newJob(l sync.Locker, f func()) *tcpip.Job {
|
||||
return tcpip.NewJob(s.clock, l, f)
|
||||
}
|
||||
|
||||
// UniqueID returns a unique identifier.
|
||||
func (s *Stack) UniqueID() uint64 {
|
||||
return s.uniqueIDGenerator.UniqueID()
|
||||
@@ -1844,11 +1839,6 @@ func (s *Stack) FindNICNameFromID(id tcpip.NICID) string {
|
||||
return nic.Name()
|
||||
}
|
||||
|
||||
// NewJob returns a new tcpip.Job using the stack's clock.
|
||||
func (s *Stack) NewJob(l sync.Locker, f func()) *tcpip.Job {
|
||||
return tcpip.NewJob(s.clock, l, f)
|
||||
}
|
||||
|
||||
// ParseResult indicates the result of a parsing attempt.
|
||||
type ParseResult int
|
||||
|
||||
|
||||
Reference in New Issue
Block a user