Skip to content
This repository has been archived by the owner on Mar 29, 2024. It is now read-only.

Commit

Permalink
Merge pull request #193 from safing/feature/high-prio-dns
Browse files Browse the repository at this point in the history
Always mark System DNS Client packets as high priority
  • Loading branch information
dhaavi authored Mar 11, 2024
2 parents a500626 + 58f7a32 commit 9c5c035
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions crew/op_connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ type ConnectRequest struct {
Domain string `json:"d,omitempty"`
IP net.IP `json:"ip,omitempty"`
UsePriorityDataMsgs bool `json:"pr,omitempty"`
AlwaysHighPriority bool `json:"hp,omitempty"`
Protocol packet.IPProtocol `json:"p,omitempty"`
Port uint16 `json:"po,omitempty"`
QueueSize uint32 `json:"qs,omitempty"`
Expand Down Expand Up @@ -125,6 +126,7 @@ func NewConnectOp(tunnel *Tunnel) (*ConnectOp, *terminal.Error) {
Protocol: packet.IPProtocol(tunnel.connInfo.Entity.Protocol),
Port: tunnel.connInfo.Entity.Port,
UsePriorityDataMsgs: terminal.UsePriorityDataMsgs,
AlwaysHighPriority: tunnel.connInfo.Process().IsSystemResolver(),
}

// Set defaults.
Expand Down Expand Up @@ -379,6 +381,8 @@ func (op *ConnectOp) connReader(_ context.Context) error {

// Define priority and possibly wait for slot.
switch {
case op.request.AlwaysHighPriority && op.request.UsePriorityDataMsgs:
msg.Unit.MakeHighPriority()
case inBytes > highPrioThreshold:
msg.Unit.WaitForSlot()
case op.request.UsePriorityDataMsgs:
Expand Down

0 comments on commit 9c5c035

Please sign in to comment.