Skip to content

Commit 31ec46c

Browse files
committed
up
1 parent 1912b6d commit 31ec46c

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

internal/imap/imap.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,12 @@ func (this *ImapServer) D(format string, args ...interface{}) {
128128
info := fmt.Sprintf(format, args...)
129129
info = strings.TrimSpace(info)
130130

131-
if this.LinkSSL {
132-
log.Debugf("[SSL]:%s", info)
133-
return
134-
}
135-
136131
if conf.Imap.Debug {
137132
log.Debug(info)
133+
134+
if this.LinkSSL {
135+
log.Debugf("[SSL]:%s", info)
136+
}
138137
}
139138
}
140139

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

684683
for {
685684
this.nlConnSSL, err = this.nlSSL.Accept()
686685
if err != nil {
687-
log.Infof("imap[ssl][conn][accept]: %v", err)
686+
this.D("[imap][ssl][conn][accept]: %v", err)
688687
return
689688
}
690689
this.start(this.nlConnSSL)

internal/pop3/pop3.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -427,8 +427,16 @@ func (this *Pop3Server) handle() {
427427
}
428428
}
429429

430+
// func (this *Pop3Server) initTLSConfigBk() {
431+
// this.TLSConfig = tools.InitAutoMakeTLSConfig()
432+
// }
433+
430434
func (this *Pop3Server) initTLSConfig() {
431-
this.TLSConfig = tools.InitAutoMakeTLSConfig()
435+
if conf.Ssl.Enable {
436+
this.TLSConfig = tools.InitAutoMakeTLSConfigWithArgs(conf.Ssl.CertFile, conf.Ssl.KeyFile)
437+
} else {
438+
this.TLSConfig = tools.InitAutoMakeTLSConfig()
439+
}
432440
}
433441

434442
func (this *Pop3Server) ready() {
@@ -456,7 +464,7 @@ func (this *Pop3Server) StartPort(port int) {
456464
addr := fmt.Sprintf(":%d", port)
457465
ln, err := net.Listen("tcp", addr)
458466
if err != nil {
459-
this.D("pop[start]:%s", err)
467+
this.D("[pop][start]:%s", err)
460468
return
461469
}
462470
defer ln.Close()
@@ -476,7 +484,7 @@ func (this *Pop3Server) StartSSLPort(port int) {
476484
addr := fmt.Sprintf(":%d", port)
477485
ln, err := tls.Listen("tcp", addr, this.TLSConfig)
478486
if err != nil {
479-
this.D("pop[start][ssl]:%T", err)
487+
this.D("[pop][start][ssl]:%T", err)
480488
return
481489
}
482490
defer ln.Close()

0 commit comments

Comments
 (0)