mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-02 23:47:07 -05:00
format log
This commit is contained in:
parent
bb3ceb3d7b
commit
8ecec9b49d
@ -17,7 +17,7 @@ var (
|
||||
)
|
||||
|
||||
func Dial(src v2net.Address, dest v2net.Destination) (internet.Connection, error) {
|
||||
log.Info("Dailing WS to ", dest)
|
||||
log.Info("WebSocket|Dailer: Creating connection to ", dest)
|
||||
if src == nil {
|
||||
src = v2net.AnyIP
|
||||
}
|
||||
@ -33,7 +33,7 @@ func Dial(src v2net.Address, dest v2net.Destination) (internet.Connection, error
|
||||
var err error
|
||||
conn, err = wsDial(src, dest)
|
||||
if err != nil {
|
||||
log.Warning("WS Dial failed:" + err.Error())
|
||||
log.Warning("WebSocket|Dialer: Dial failed: ", err)
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
@ -45,26 +45,22 @@ func ListenWS(address v2net.Address, port v2net.Port) (internet.Listener, error)
|
||||
func (wsl *WSListener) listenws(address v2net.Address, port v2net.Port) error {
|
||||
|
||||
http.HandleFunc("/"+effectiveConfig.Path, func(w http.ResponseWriter, r *http.Request) {
|
||||
log.Warning("WS:WSListener->listenws->(HandleFunc,lambda 2)! Accepting websocket")
|
||||
con, err := wsl.converttovws(w, r)
|
||||
if err != nil {
|
||||
log.Warning("WS:WSListener->listenws->(HandleFunc,lambda 2)!" + err.Error())
|
||||
log.Warning("WebSocket|Listener: Failed to convert connection: ", err)
|
||||
return
|
||||
}
|
||||
|
||||
select {
|
||||
case wsl.awaitingConns <- &ConnectionWithError{
|
||||
conn: con,
|
||||
err: err,
|
||||
}:
|
||||
log.Warning("WS:WSListener->listenws->(HandleFunc,lambda 2)! transferd websocket")
|
||||
default:
|
||||
if con != nil {
|
||||
con.Close()
|
||||
}
|
||||
}
|
||||
return
|
||||
|
||||
})
|
||||
|
||||
errchan := make(chan error)
|
||||
@ -106,7 +102,7 @@ func (wsl *WSListener) listenws(address v2net.Address, port v2net.Port) error {
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
log.Error("WS:WSListener->listenws->ListenAndServe!" + err.Error())
|
||||
log.Error("WebSocket|Listener: Failed to serve: ", err)
|
||||
}
|
||||
|
||||
return err
|
||||
@ -133,7 +129,6 @@ func (this *WSListener) Accept() (internet.Connection, error) {
|
||||
for this.acccepting {
|
||||
select {
|
||||
case connErr, open := <-this.awaitingConns:
|
||||
log.Info("WSListener: conn accepted")
|
||||
if !open {
|
||||
return nil, ErrClosedListener
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user