mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-22 18:17:52 -05:00
Don't block main thread when writing access log.
This commit is contained in:
parent
95b44f2160
commit
c7c493f20e
@ -42,11 +42,15 @@ func (logger *fileAccessLogger) close() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (logger *fileAccessLogger) Log(from, to string, status AccessStatus, reason string) {
|
func (logger *fileAccessLogger) Log(from, to string, status AccessStatus, reason string) {
|
||||||
logger.queue <- &accessLog{
|
select {
|
||||||
|
case logger.queue <- &accessLog{
|
||||||
From: from,
|
From: from,
|
||||||
To: to,
|
To: to,
|
||||||
Status: status,
|
Status: status,
|
||||||
Reason: reason,
|
Reason: reason,
|
||||||
|
}:
|
||||||
|
default:
|
||||||
|
// We don't expect this to happen, but don't want to block main thread as well.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user