mirror of
https://github.com/v2ray/v2ray-core.git
synced 2026-11-20 15:05:09 +00:00
remove release() pattern
This commit is contained in:
33 files changed
+17
-232
No files matched your search
@@ -4,12 +4,10 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"v2ray.com/core/common"
|
||||
"v2ray.com/core/common/serial"
|
||||
)
|
||||
|
||||
type LogEntry interface {
|
||||
common.Releasable
|
||||
fmt.Stringer
|
||||
}
|
||||
|
||||
@@ -18,12 +16,6 @@ type ErrorLog struct {
|
||||
Values []interface{}
|
||||
}
|
||||
|
||||
func (v *ErrorLog) Release() {
|
||||
for _, val := range v.Values {
|
||||
common.Release(val)
|
||||
}
|
||||
}
|
||||
|
||||
func (v *ErrorLog) String() string {
|
||||
return v.Prefix + serial.Concat(v.Values...)
|
||||
}
|
||||
@@ -35,12 +27,6 @@ type AccessLog struct {
|
||||
Reason interface{}
|
||||
}
|
||||
|
||||
func (v *AccessLog) Release() {
|
||||
common.Release(v.From)
|
||||
common.Release(v.To)
|
||||
common.Release(v.Reason)
|
||||
}
|
||||
|
||||
func (v *AccessLog) String() string {
|
||||
return strings.Join([]string{serial.ToString(v.From), v.Status, serial.ToString(v.To), serial.ToString(v.Reason)}, " ")
|
||||
}
|
||||
@@ -17,9 +17,7 @@ type LogWriter interface {
|
||||
type NoOpLogWriter struct {
|
||||
}
|
||||
|
||||
func (v *NoOpLogWriter) Log(entry LogEntry) {
|
||||
entry.Release()
|
||||
}
|
||||
func (v *NoOpLogWriter) Log(entry LogEntry) {}
|
||||
|
||||
func (v *NoOpLogWriter) Close() {
|
||||
}
|
||||
@@ -38,7 +36,6 @@ func NewStdOutLogWriter() LogWriter {
|
||||
|
||||
func (v *StdOutLogWriter) Log(log LogEntry) {
|
||||
v.logger.Print(log.String() + platform.LineSeparator())
|
||||
log.Release()
|
||||
}
|
||||
|
||||
func (v *StdOutLogWriter) Close() {
|
||||
@@ -58,7 +55,6 @@ func (v *FileLogWriter) Log(log LogEntry) {
|
||||
default:
|
||||
// We don't expect this to happen, but don't want to block main thread as well.
|
||||
}
|
||||
log.Release()
|
||||
}
|
||||
|
||||
func (v *FileLogWriter) run() {
|
||||
|
||||
Reference in new issue
Block a user