Skip to content

Commit

Permalink
no logging after header logging
Browse files Browse the repository at this point in the history
  • Loading branch information
linyows committed Oct 16, 2023
1 parent a3d9cf7 commit fbc2cb6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pipe.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ type Pipe struct {
blocker chan interface{}

isWaitedStarttlsRes bool
isHeaderRemoved bool

timeAtConnected time.Time
timeAtDataStarting time.Time
Expand Down Expand Up @@ -104,7 +105,9 @@ func (p *Pipe) mediateOnUpstream(b []byte, i int) ([]byte, int, bool) {
p.waitForTLSConn(b, i)
go p.afterCommHook(data, pxyToDst)
} else {
go p.afterCommHook(p.removeMailBody(data), srcToDst)
if !p.isHeaderRemoved {
go p.afterCommHook(p.removeMailBody(data), srcToDst)
}
}

return b, i, false
Expand Down Expand Up @@ -358,6 +361,7 @@ func (p *Pipe) removeMailBody(b Data) Data {
if i == -1 {
return b
}
p.isHeaderRemoved = true
return b[:i]
}

Expand Down

0 comments on commit fbc2cb6

Please sign in to comment.