Skip to content

Commit

Permalink
Add calls to policy enforcer helpers
Browse files Browse the repository at this point in the history
Signed-off-by: Kirtana Ashok <[email protected]>
  • Loading branch information
kiashok committed Jan 6, 2025
1 parent 915a38f commit 2fc3644
Show file tree
Hide file tree
Showing 4 changed files with 228 additions and 139 deletions.
14 changes: 13 additions & 1 deletion cmd/gcs-sidecar/internal/bridge/bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,12 @@ func (b *Bridge) AssignHandlers() {
b.HandleFunc(rpcLifecycleNotification, b.lifecycleNotification) // TODO: Validate this request as well?
}

type messageHeader struct {
Type uint32
Size uint32
ID int64
}

func readMessage(r io.Reader) (request, error) {
var h [hdrSize]byte
_, err := io.ReadFull(r, h[:])
Expand Down Expand Up @@ -245,7 +251,12 @@ func (b *Bridge) ListenAndServeShimRequests() error {
recverr = errors.Wrap(err, "bridge read from shim failed:")
break
}
log.Printf("bridge recv from shim: \n Header: %v \n msg: %v \n", "", string(req.message))
var header messageHeader
messageTyp := msgType(binary.LittleEndian.Uint32(req.header[hdrOffType:]))
header.Type = binary.LittleEndian.Uint32(req.header[hdrOffType:])
header.Size = binary.LittleEndian.Uint32(req.header[hdrOffSize:])
header.ID = int64(binary.LittleEndian.Uint64(req.header[hdrOffID:]))
log.Printf("bridge recv from shim: \n Header {Type: %v Size: %v ID: %v }\n msg: %v \n", messageTyp, header.Size, header.ID, string(req.message))
shimRequestChan <- req
}
shimRequestErrChan <- recverr
Expand All @@ -262,6 +273,7 @@ func (b *Bridge) ListenAndServeShimRequests() error {
// 2. Code cleanup on error
// ? b.close(err)
// b.quitCh <- true // give few seconds delay and close connections?
b.close(err)
return
}

Expand Down
Loading

0 comments on commit 2fc3644

Please sign in to comment.