mirror of
https://github.com/bluenviron/mediamtx.git
synced 2025-12-25 04:22:00 -08:00
move protocol-related code into internal/protocols (#2572)
This commit is contained in:
parent
3ebc585539
commit
99bc327d67
126 changed files with 73 additions and 73 deletions
|
|
@ -1,27 +0,0 @@
|
|||
package httpserv
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
"runtime"
|
||||
)
|
||||
|
||||
// exit when there's a panic inside the HTTP handler.
|
||||
// https://github.com/golang/go/issues/16542
|
||||
type handlerExitOnPanic struct {
|
||||
http.Handler
|
||||
}
|
||||
|
||||
func (h *handlerExitOnPanic) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
defer func() {
|
||||
err := recover()
|
||||
if err != nil {
|
||||
buf := make([]byte, 1<<20)
|
||||
n := runtime.Stack(buf, true)
|
||||
fmt.Fprintf(os.Stderr, "panic: %v\n\n%s", err, buf[:n])
|
||||
os.Exit(1)
|
||||
}
|
||||
}()
|
||||
h.Handler.ServeHTTP(w, r)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue