Skip to content

Commit 399920c

Browse files
committedJun 10, 2020
added timeout.read & timeout.write flags
1 parent 117ee6a commit 399920c

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed
 

‎main.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ import (
1515

1616
func main() {
1717
cfg := smtpsrv.ServerConfig{
18-
ReadTimeout: 60 * time.Second,
18+
ReadTimeout: time.Duration(*flagReadTimeout) * time.Second,
19+
WriteTimeout: time.Duration(*flagWriteTimeout) * time.Second,
1920
ListenAddr: *flagListenAddr,
2021
MaxMessageBytes: int(*flagMaxMessageSize),
2122
BannerDomain: *flagServerName,

‎vars.go

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ var (
77
flagListenAddr = flag.String("listen", ":smtp", "the smtp address to listen on")
88
flagWebhook = flag.String("webhook", "http://localhost:8080/my/webhook", "the webhook to send the data to")
99
flagMaxMessageSize = flag.Int64("msglimit", 1024*1024*2, "maximum incoming message size")
10+
flagReadTimeout = flag.Int("timeout.read", 5, "the read timeout in seconds")
11+
flagWriteTimeout = flag.Int("timeout.write", 5, "the write timeout in seconds")
1012
)
1113

1214
func init() {

0 commit comments

Comments
 (0)
Failed to load comments.