mirror of https://github.com/Dreamacro/clash.git
Chore: unify log text in listener (#2884)
This commit is contained in:
parent
e5f2396f81
commit
c70c08af96
|
@ -88,13 +88,13 @@ func createListener(inbound C.Inbound, tcpIn chan<- C.ConnContext, udpIn chan<-
|
||||||
tcpCreator := tcpListenerCreators[inbound.Type]
|
tcpCreator := tcpListenerCreators[inbound.Type]
|
||||||
udpCreator := udpListenerCreators[inbound.Type]
|
udpCreator := udpListenerCreators[inbound.Type]
|
||||||
if tcpCreator == nil && udpCreator == nil {
|
if tcpCreator == nil && udpCreator == nil {
|
||||||
log.Errorln("inbound type %s not support.", inbound.Type)
|
log.Errorln("inbound type %s is not supported", inbound.Type)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if tcpCreator != nil {
|
if tcpCreator != nil {
|
||||||
tcpListener, err := tcpCreator(addr, tcpIn)
|
tcpListener, err := tcpCreator(addr, tcpIn)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorln("create addr %s tcp listener error. err:%v", addr, err)
|
log.Errorln("create addr %s tcp listener error: %v", addr, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
tcpListeners[inbound] = tcpListener
|
tcpListeners[inbound] = tcpListener
|
||||||
|
@ -102,26 +102,26 @@ func createListener(inbound C.Inbound, tcpIn chan<- C.ConnContext, udpIn chan<-
|
||||||
if udpCreator != nil {
|
if udpCreator != nil {
|
||||||
udpListener, err := udpCreator(addr, udpIn)
|
udpListener, err := udpCreator(addr, udpIn)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorln("create addr %s udp listener error. err:%v", addr, err)
|
log.Errorln("create addr %s udp listener error: %v", addr, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
udpListeners[inbound] = udpListener
|
udpListeners[inbound] = udpListener
|
||||||
}
|
}
|
||||||
log.Infoln("inbound %s create success.", inbound.ToAlias())
|
log.Infoln("inbound %s created successfully", inbound.ToAlias())
|
||||||
}
|
}
|
||||||
|
|
||||||
func closeListener(inbound C.Inbound) {
|
func closeListener(inbound C.Inbound) {
|
||||||
listener := tcpListeners[inbound]
|
listener := tcpListeners[inbound]
|
||||||
if listener != nil {
|
if listener != nil {
|
||||||
if err := listener.Close(); err != nil {
|
if err := listener.Close(); err != nil {
|
||||||
log.Errorln("close tcp address `%s` error. err:%s", inbound.ToAlias(), err.Error())
|
log.Errorln("close tcp address `%s` error: %s", inbound.ToAlias(), err.Error())
|
||||||
}
|
}
|
||||||
delete(tcpListeners, inbound)
|
delete(tcpListeners, inbound)
|
||||||
}
|
}
|
||||||
listener = udpListeners[inbound]
|
listener = udpListeners[inbound]
|
||||||
if listener != nil {
|
if listener != nil {
|
||||||
if err := listener.Close(); err != nil {
|
if err := listener.Close(); err != nil {
|
||||||
log.Errorln("close udp address `%s` error. err:%s", inbound.ToAlias(), err.Error())
|
log.Errorln("close udp address `%s` error: %s", inbound.ToAlias(), err.Error())
|
||||||
}
|
}
|
||||||
delete(udpListeners, inbound)
|
delete(udpListeners, inbound)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue