Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
midoks committed Sep 30, 2022
1 parent 1912b6d commit 31ec46c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
13 changes: 6 additions & 7 deletions internal/imap/imap.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,12 @@ func (this *ImapServer) D(format string, args ...interface{}) {
info := fmt.Sprintf(format, args...)
info = strings.TrimSpace(info)

if this.LinkSSL {
log.Debugf("[SSL]:%s", info)
return
}

if conf.Imap.Debug {
log.Debug(info)

if this.LinkSSL {
log.Debugf("[SSL]:%s", info)
}
}
}

Expand Down Expand Up @@ -676,15 +675,15 @@ func (this *ImapServer) StartSSLPort(port int) {
addr := fmt.Sprintf(":%d", port)
this.nlSSL, err = tls.Listen("tcp", addr, this.TLSConfig)
if err != nil {
log.Infof("imap[ssl][conn][listen]: %v", err)
this.D("[imap][ssl][conn][listen]: %v", err)
return
}
defer this.nlSSL.Close()

for {
this.nlConnSSL, err = this.nlSSL.Accept()
if err != nil {
log.Infof("imap[ssl][conn][accept]: %v", err)
this.D("[imap][ssl][conn][accept]: %v", err)
return
}
this.start(this.nlConnSSL)
Expand Down
14 changes: 11 additions & 3 deletions internal/pop3/pop3.go
Original file line number Diff line number Diff line change
Expand Up @@ -427,8 +427,16 @@ func (this *Pop3Server) handle() {
}
}

// func (this *Pop3Server) initTLSConfigBk() {
// this.TLSConfig = tools.InitAutoMakeTLSConfig()
// }

func (this *Pop3Server) initTLSConfig() {
this.TLSConfig = tools.InitAutoMakeTLSConfig()
if conf.Ssl.Enable {
this.TLSConfig = tools.InitAutoMakeTLSConfigWithArgs(conf.Ssl.CertFile, conf.Ssl.KeyFile)
} else {
this.TLSConfig = tools.InitAutoMakeTLSConfig()
}
}

func (this *Pop3Server) ready() {
Expand Down Expand Up @@ -456,7 +464,7 @@ func (this *Pop3Server) StartPort(port int) {
addr := fmt.Sprintf(":%d", port)
ln, err := net.Listen("tcp", addr)
if err != nil {
this.D("pop[start]:%s", err)
this.D("[pop][start]:%s", err)
return
}
defer ln.Close()
Expand All @@ -476,7 +484,7 @@ func (this *Pop3Server) StartSSLPort(port int) {
addr := fmt.Sprintf(":%d", port)
ln, err := tls.Listen("tcp", addr, this.TLSConfig)
if err != nil {
this.D("pop[start][ssl]:%T", err)
this.D("[pop][start][ssl]:%T", err)
return
}
defer ln.Close()
Expand Down

0 comments on commit 31ec46c

Please sign in to comment.