tris: add single line TLSDEBUG=short
This commit is contained in:
parent
7aa542753f
commit
740fc926aa
20
13.go
20
13.go
@ -13,8 +13,11 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"hash"
|
"hash"
|
||||||
"io"
|
"io"
|
||||||
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
"runtime"
|
||||||
"runtime/debug"
|
"runtime/debug"
|
||||||
|
"strings"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -572,4 +575,21 @@ func (hs *serverHandshakeState) traceErr(err error) {
|
|||||||
}
|
}
|
||||||
fmt.Fprintf(os.Stderr, "\n%s\n", debug.Stack())
|
fmt.Fprintf(os.Stderr, "\n%s\n", debug.Stack())
|
||||||
}
|
}
|
||||||
|
if os.Getenv("TLSDEBUG") == "short" {
|
||||||
|
var pcs [4]uintptr
|
||||||
|
frames := runtime.CallersFrames(pcs[0:runtime.Callers(3, pcs[:])])
|
||||||
|
for {
|
||||||
|
frame, more := frames.Next()
|
||||||
|
if frame.Function != "crypto/tls.(*halfConn).setErrorLocked" &&
|
||||||
|
frame.Function != "crypto/tls.(*Conn).sendAlertLocked" &&
|
||||||
|
frame.Function != "crypto/tls.(*Conn).sendAlert" {
|
||||||
|
file := frame.File[strings.LastIndex(frame.File, "/")+1:]
|
||||||
|
log.Printf("%s:%d (%s): %v", file, frame.Line, frame.Function, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !more {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user