Skip to content

Commit

Permalink
added timeout.read & timeout.write flags
Browse files Browse the repository at this point in the history
  • Loading branch information
alash3al committed Jun 10, 2020
1 parent 117ee6a commit 399920c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import (

func main() {
cfg := smtpsrv.ServerConfig{
ReadTimeout: 60 * time.Second,
ReadTimeout: time.Duration(*flagReadTimeout) * time.Second,
WriteTimeout: time.Duration(*flagWriteTimeout) * time.Second,
ListenAddr: *flagListenAddr,
MaxMessageBytes: int(*flagMaxMessageSize),
BannerDomain: *flagServerName,
Expand Down
2 changes: 2 additions & 0 deletions vars.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ var (
flagListenAddr = flag.String("listen", ":smtp", "the smtp address to listen on")
flagWebhook = flag.String("webhook", "http://localhost:8080/my/webhook", "the webhook to send the data to")
flagMaxMessageSize = flag.Int64("msglimit", 1024*1024*2, "maximum incoming message size")
flagReadTimeout = flag.Int("timeout.read", 5, "the read timeout in seconds")
flagWriteTimeout = flag.Int("timeout.write", 5, "the write timeout in seconds")
)

func init() {
Expand Down

0 comments on commit 399920c

Please sign in to comment.