Skip to content

Commit

Permalink
reduce loop logic
Browse files Browse the repository at this point in the history
  • Loading branch information
xhit committed Jul 6, 2023
1 parent 8d54542 commit fcf2fd2
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions email_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func startService(port int, responses []string, timeout time.Duration) {

func respond(conn net.Conn, responses []string, timeout time.Duration) {
buf := make([]byte, 1024)
for i, resp := range responses {
for _, resp := range responses {
write(conn, resp)
n, err := conn.Read(buf)
if err != nil {
Expand All @@ -93,10 +93,6 @@ func respond(conn net.Conn, responses []string, timeout time.Duration) {
}
readStr := string(buf[:n])
log.Printf("READ:%s", string(readStr))

if i == len(responses)-1 {
break
}
}

// if timeout, sleep for that time, otherwise sent a 250 OK
Expand Down

0 comments on commit fcf2fd2

Please sign in to comment.