mirror of
https://github.com/bjdgyc/anylink.git
synced 2025-09-19 01:47:10 +08:00
logAudit引入recover, 防止主程序崩溃.
This commit is contained in:
@@ -3,6 +3,7 @@ package handler
|
|||||||
import (
|
import (
|
||||||
"crypto/md5"
|
"crypto/md5"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
|
"runtime/debug"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/bjdgyc/anylink/base"
|
"github.com/bjdgyc/anylink/base"
|
||||||
@@ -101,7 +102,12 @@ func logAuditBatch() {
|
|||||||
|
|
||||||
// 解析IP包的数据
|
// 解析IP包的数据
|
||||||
func logAudit(userName string, pl *sessdata.Payload) {
|
func logAudit(userName string, pl *sessdata.Payload) {
|
||||||
defer putPayload(pl)
|
defer func() {
|
||||||
|
putPayload(pl)
|
||||||
|
if err := recover(); err != nil {
|
||||||
|
base.Error("logAudit is panic: ", err, "\n", string(debug.Stack()), "\n", pl.Data)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
if !(pl.LType == sessdata.LTypeIPData && pl.PType == 0x00) {
|
if !(pl.LType == sessdata.LTypeIPData && pl.PType == 0x00) {
|
||||||
return
|
return
|
||||||
|
Reference in New Issue
Block a user