Skip to content

Commit ff8f376

Browse files
committed
server: rename toSMTPStatus to dataErrorToStatus
Make it clear this should only be used for DATA/BDAT.
1 parent bec733d commit ff8f376

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

conn.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,7 @@ func (c *Conn) handleData(arg string) {
909909
}
910910

911911
r := newDataReader(c)
912-
code, enhancedCode, msg := toSMTPStatus(c.Session().Data(r))
912+
code, enhancedCode, msg := dataErrorToStatus(c.Session().Data(r))
913913
r.limited = false
914914
io.Copy(ioutil.Discard, r) // Make sure all the data has been consumed
915915
c.writeResponse(code, enhancedCode, msg)
@@ -1006,7 +1006,7 @@ func (c *Conn) handleBdat(arg string) {
10061006
// the whole chunk.
10071007
io.Copy(ioutil.Discard, chunk)
10081008

1009-
c.writeResponse(toSMTPStatus(err))
1009+
c.writeResponse(dataErrorToStatus(err))
10101010

10111011
if err == errPanic {
10121012
c.Close()
@@ -1029,11 +1029,11 @@ func (c *Conn) handleBdat(arg string) {
10291029
if c.server.LMTP {
10301030
c.bdatStatus.fillRemaining(err)
10311031
for i, rcpt := range c.recipients {
1032-
code, enchCode, msg := toSMTPStatus(<-c.bdatStatus.status[i])
1032+
code, enchCode, msg := dataErrorToStatus(<-c.bdatStatus.status[i])
10331033
c.writeResponse(code, enchCode, "<"+rcpt+"> "+msg)
10341034
}
10351035
} else {
1036-
c.writeResponse(toSMTPStatus(err))
1036+
c.writeResponse(dataErrorToStatus(err))
10371037
}
10381038

10391039
if err == errPanic {
@@ -1168,7 +1168,7 @@ func (c *Conn) handleDataLMTP() {
11681168
}
11691169

11701170
for i, rcpt := range c.recipients {
1171-
code, enchCode, msg := toSMTPStatus(<-status.status[i])
1171+
code, enchCode, msg := dataErrorToStatus(<-status.status[i])
11721172
c.writeResponse(code, enchCode, "<"+rcpt+"> "+msg)
11731173
}
11741174

@@ -1179,7 +1179,7 @@ func (c *Conn) handleDataLMTP() {
11791179
}
11801180
}
11811181

1182-
func toSMTPStatus(err error) (code int, enchCode EnhancedCode, msg string) {
1182+
func dataErrorToStatus(err error) (code int, enchCode EnhancedCode, msg string) {
11831183
if err != nil {
11841184
if smtperr, ok := err.(*SMTPError); ok {
11851185
return smtperr.Code, smtperr.EnhancedCode, smtperr.Message

0 commit comments

Comments
 (0)