Don't block main thread when writing access log.

pull/40/head
V2Ray 2015-10-11 16:06:27 +02:00
parent 95b44f2160
commit c7c493f20e
1 changed files with 5 additions and 1 deletions

View File

@ -42,11 +42,15 @@ func (logger *fileAccessLogger) close() {
}
func (logger *fileAccessLogger) Log(from, to string, status AccessStatus, reason string) {
logger.queue <- &accessLog{
select {
case logger.queue <- &accessLog{
From: from,
To: to,
Status: status,
Reason: reason,
}:
default:
// We don't expect this to happen, but don't want to block main thread as well.
}
}