Revert "lib/tunnel: make each conn have its own server"
This reverts commit f3c299acf9
.
This commit is contained in:
parent
f3c299acf9
commit
2aa7295c8a
|
@ -62,9 +62,12 @@ func (p *HTTPProxy) Proxy(remote net.Conn, msg *proto.ControlMessage) {
|
|||
localAddr = p.LocalAddr
|
||||
}
|
||||
|
||||
if p.rp == nil {
|
||||
if p.hs == nil {
|
||||
su, _ := url.Parse(fmt.Sprintf("http://%s", p.LocalAddr))
|
||||
p.rp = httputil.NewSingleHostReverseProxy(su)
|
||||
p.hs = &http.Server{
|
||||
Handler: p.rp,
|
||||
}
|
||||
}
|
||||
|
||||
log.Debug("Dialing local server %q", localAddr)
|
||||
|
@ -73,11 +76,7 @@ func (p *HTTPProxy) Proxy(remote net.Conn, msg *proto.ControlMessage) {
|
|||
conn: remote,
|
||||
}
|
||||
|
||||
hs := &http.Server{
|
||||
Handler: p.rp,
|
||||
}
|
||||
|
||||
err := hs.Serve(sl)
|
||||
err := p.hs.Serve(sl)
|
||||
if err != nil {
|
||||
log.Error("Dialing local server %q failed: %s", localAddr, err)
|
||||
p.sendError(remote)
|
||||
|
|
Loading…
Reference in New Issue