Skip to content

Commit

Permalink
lxd: Add comments to exported types/methods (revive: exported).
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Laing <[email protected]>
  • Loading branch information
markylaing committed Jul 15, 2024
1 parent 9eae54b commit 31b5ffa
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lxd/devlxd.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,11 +372,15 @@ func devLxdAPI(d *Daemon, f hoistFunc) http.Handler {
*/
var pidMapper = ConnPidMapper{m: map[*net.UnixConn]*unix.Ucred{}}

// ConnPidMapper is threadsafe cache of unix connections to process IDs. We use this in hoistReq to determine
// the instance that the connection has been made from.
type ConnPidMapper struct {
m map[*net.UnixConn]*unix.Ucred
mLock sync.Mutex
}

// ConnStateHandler is used in the `ConnState` field of the devlxd http.Server so that we can cache the process ID of the
// caller when a new connection is made and delete it when the connection is closed.
func (m *ConnPidMapper) ConnStateHandler(conn net.Conn, state http.ConnState) {
unixConn, _ := conn.(*net.UnixConn)
if unixConn == nil {
Expand Down

0 comments on commit 31b5ffa

Please sign in to comment.