We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6c2d0c0 commit baba10cCopy full SHA for baba10c
server.go
@@ -157,12 +157,16 @@ func (self *Server) Connect(w http.ResponseWriter, r *http.Request) {
157
158
// Proxy is no need to know anything, just exchange data between the client
159
// the the remote server.
160
- copyAndWait := func(dst io.Writer, src io.Reader, c chan int64) {
+ copyAndWait := func(dst, src net.Conn, c chan int64) {
161
n, err := io.Copy(dst, src)
162
if err != nil {
163
L.Printf("Copy: %s\n", err.Error())
164
// FIXME: how to report error to dst ?
165
}
166
+ // src is closed, should close dst, also set src write deadline
167
+ t := time.Now().Add(10 * time.Second)
168
+ dst.SetDeadline(t)
169
+ src.SetDeadline(t)
170
c <- n
171
172
0 commit comments