MCPcopy Index your code
hub / github.com/docker/cli / Close

Method Close

cli-plugins/socket/socket.go:97–111  ·  view source on GitHub ↗

Close ensures that the server is no longer accepting new connections and closes all existing connections. Existing connections will receive [io.EOF]. The error value is that of the underlying [net.Listener.Close] call.

()

Source from the content-addressed store, hash-verified

95//
96// The error value is that of the underlying [net.Listener.Close] call.
97func (pl *PluginServer) Close() error {
98 if pl == nil {
99 return nil
100 }
101 logrus.Trace("Closing plugin server")
102 // Close connections first to ensure the connections get io.EOF instead
103 // of a connection reset.
104 pl.closeAllConns()
105
106 // Try to ensure that any active connections have a chance to receive
107 // io.EOF.
108 runtime.Gosched()
109
110 return pl.l.Close()
111}
112
113func (pl *PluginServer) closeAllConns() {
114 pl.mu.Lock()

Callers 6

TestPluginServerFunction · 0.95
TestConnectAndWaitFunction · 0.95
NewPluginServerFunction · 0.95
tryPluginRunFunction · 0.95
acceptMethod · 0.45
closeAllConnsMethod · 0.45

Calls 1

closeAllConnsMethod · 0.95

Tested by 2

TestPluginServerFunction · 0.76
TestConnectAndWaitFunction · 0.76