pull/2034/head
v2ray 8 years ago
parent bb3ceb3d7b
commit 8ecec9b49d
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

@ -17,7 +17,7 @@ var (
) )
func Dial(src v2net.Address, dest v2net.Destination) (internet.Connection, error) { 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 { if src == nil {
src = v2net.AnyIP src = v2net.AnyIP
} }
@ -33,7 +33,7 @@ func Dial(src v2net.Address, dest v2net.Destination) (internet.Connection, error
var err error var err error
conn, err = wsDial(src, dest) conn, err = wsDial(src, dest)
if err != nil { if err != nil {
log.Warning("WS Dial failed:" + err.Error()) log.Warning("WebSocket|Dialer: Dial failed: ", err)
return nil, 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 { func (wsl *WSListener) listenws(address v2net.Address, port v2net.Port) error {
http.HandleFunc("/"+effectiveConfig.Path, func(w http.ResponseWriter, r *http.Request) { 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) con, err := wsl.converttovws(w, r)
if err != nil { if err != nil {
log.Warning("WS:WSListener->listenws->(HandleFunc,lambda 2)!" + err.Error()) log.Warning("WebSocket|Listener: Failed to convert connection: ", err)
return return
} }
select { select {
case wsl.awaitingConns <- &ConnectionWithError{ case wsl.awaitingConns <- &ConnectionWithError{
conn: con, conn: con,
err: err,
}: }:
log.Warning("WS:WSListener->listenws->(HandleFunc,lambda 2)! transferd websocket")
default: default:
if con != nil { if con != nil {
con.Close() con.Close()
} }
} }
return return
}) })
errchan := make(chan error) errchan := make(chan error)
@ -106,7 +102,7 @@ func (wsl *WSListener) listenws(address v2net.Address, port v2net.Port) error {
} }
if err != nil { if err != nil {
log.Error("WS:WSListener->listenws->ListenAndServe!" + err.Error()) log.Error("WebSocket|Listener: Failed to serve: ", err)
} }
return err return err
@ -133,7 +129,6 @@ func (this *WSListener) Accept() (internet.Connection, error) {
for this.acccepting { for this.acccepting {
select { select {
case connErr, open := <-this.awaitingConns: case connErr, open := <-this.awaitingConns:
log.Info("WSListener: conn accepted")
if !open { if !open {
return nil, ErrClosedListener return nil, ErrClosedListener
} }

Loading…
Cancel
Save