mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
netstack: update goroutine save / restore safety comments.
PiperOrigin-RevId: 204930314 Change-Id: Ifc4c41ed28616cd57fafbf7c92e87141a945c41f
This commit is contained in:
@@ -108,7 +108,10 @@ func New(opts *Options) tcpip.LinkEndpointID {
|
||||
// dispatches them via the provided dispatcher.
|
||||
func (e *endpoint) Attach(dispatcher stack.NetworkDispatcher) {
|
||||
e.attached = true
|
||||
go e.dispatchLoop(dispatcher) // S/R-FIXME
|
||||
// Link endpoints are not savable. When transportation endpoints are
|
||||
// saved, they stop sending outgoing packets and all incoming packets
|
||||
// are rejected.
|
||||
go e.dispatchLoop(dispatcher) // S/R-SAFE: See above.
|
||||
}
|
||||
|
||||
// IsAttached implements stack.LinkEndpoint.IsAttached.
|
||||
|
||||
@@ -142,7 +142,10 @@ func (e *endpoint) Attach(dispatcher stack.NetworkDispatcher) {
|
||||
if !e.workerStarted && atomic.LoadUint32(&e.stopRequested) == 0 {
|
||||
e.workerStarted = true
|
||||
e.completed.Add(1)
|
||||
go e.dispatchLoop(dispatcher) // S/R-FIXME
|
||||
// Link endpoints are not savable. When transportation endpoints
|
||||
// are saved, they stop sending outgoing packets and all
|
||||
// incoming packets are rejected.
|
||||
go e.dispatchLoop(dispatcher) // S/R-SAFE: see above.
|
||||
}
|
||||
e.mu.Unlock()
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ func main() {
|
||||
|
||||
// Start the writer in its own goroutine.
|
||||
writerCompletedCh := make(chan struct{})
|
||||
go writer(writerCompletedCh, ep) // S/R-FIXME
|
||||
go writer(writerCompletedCh, ep) // S/R-SAFE: sample code.
|
||||
|
||||
// Read data and write to standard output until the peer closes the
|
||||
// connection from its side.
|
||||
|
||||
@@ -187,6 +187,6 @@ func main() {
|
||||
log.Fatal("Accept() failed:", err)
|
||||
}
|
||||
|
||||
go echo(wq, n) // S/R-FIXME
|
||||
go echo(wq, n) // S/R-SAFE: sample code.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ func (c *linkAddrCache) startAddressResolution(k tcpip.FullAddress, linkRes Link
|
||||
e := c.makeAndAddEntry(k, "")
|
||||
e.addWaker(waker)
|
||||
|
||||
go func() { // S/R-FIXME
|
||||
go func() { // S/R-SAFE: link non-savable; wakers dropped synchronously.
|
||||
for i := 0; ; i++ {
|
||||
// Send link request, then wait for the timeout limit and check
|
||||
// whether the request succeeded.
|
||||
|
||||
@@ -90,7 +90,7 @@ func (f *Forwarder) HandlePacket(r *stack.Route, id stack.TransportEndpointID, v
|
||||
// Launch a new goroutine to handle the request.
|
||||
f.inFlight[id] = struct{}{}
|
||||
s.incRef()
|
||||
go f.handler(&ForwarderRequest{ // S/R-FIXME
|
||||
go f.handler(&ForwarderRequest{ // S/R-SAFE: not used by Sentry.
|
||||
forwarder: f,
|
||||
segment: s,
|
||||
synOptions: opts,
|
||||
|
||||
Reference in New Issue
Block a user