@@ -103,18 +103,16 @@ func New(tmpDir string) (*NotifyProxy, error) {
103
103
// Start waiting for the READY message in the background. This way,
104
104
// the proxy can be created prior to starting the container and
105
105
// circumvents a race condition on writing/reading on the socket.
106
- proxy .waitForReady ()
106
+ proxy .listen ()
107
107
108
108
return proxy , nil
109
109
}
110
110
111
- // waitForReady waits for the READY message in the background. The goroutine
112
- // returns on receiving READY or when the socket is closed.
113
- func (p * NotifyProxy ) waitForReady () {
111
+ // listen waits for the READY message in the background, and process file
112
+ // descriptors and barriers send over the NOTIFY_SOCKET. The goroutine returns
113
+ // when the socket is closed.
114
+ func (p * NotifyProxy ) listen () {
114
115
go func () {
115
- // Read until the `READY` message is received or the connection
116
- // is closed.
117
-
118
116
// See https://github.com/containers/podman/issues/16515 for a description of the protocol.
119
117
fdSize := unix .CmsgSpace (4 )
120
118
buffer := make ([]byte , _notifyBufferMax )
@@ -128,6 +126,7 @@ func (p *NotifyProxy) waitForReady() {
128
126
return
129
127
}
130
128
logrus .Errorf ("Error reading unix message on socket %q: %v" , p .socketPath , err )
129
+ continue
131
130
}
132
131
133
132
if n > _notifyBufferMax || oobn > _notifyFdMax * fdSize {
@@ -207,7 +206,7 @@ type Container interface {
207
206
ID () string
208
207
}
209
208
210
- // WaitAndClose waits until receiving the `READY` notify message. Note that the
209
+ // Wait waits until receiving the `READY` notify message. Note that the
211
210
// this function must only be executed inside a systemd service which will kill
212
211
// the process after a given timeout. If the (optional) container stopped
213
212
// running before the `READY` is received, the waiting gets canceled and
0 commit comments