()
| 65 | } |
| 66 | |
| 67 | func (pl *PluginServer) accept() error { |
| 68 | conn, err := pl.l.Accept() |
| 69 | if err != nil { |
| 70 | return err |
| 71 | } |
| 72 | |
| 73 | pl.mu.Lock() |
| 74 | defer pl.mu.Unlock() |
| 75 | |
| 76 | if pl.closed { |
| 77 | // Handle potential race between Close and accept. |
| 78 | conn.Close() |
| 79 | return errors.New("plugin server is closed") |
| 80 | } |
| 81 | |
| 82 | pl.conns = append(pl.conns, conn) |
| 83 | |
| 84 | go pl.h(conn) |
| 85 | return nil |
| 86 | } |
| 87 | |
| 88 | // Addr returns the [net.Addr] of the underlying [net.Listener]. |
| 89 | func (pl *PluginServer) Addr() net.Addr { |
no test coverage detected