use a WriteCloser and close the pipe in streams
This commit is contained in:
parent
3c37581465
commit
daf1ac8c67
|
@ -13,12 +13,13 @@ func (d *Daemon) doStreamPipe(c net.Conn, s inet.Stream) {
|
|||
var wg sync.WaitGroup
|
||||
wg.Add(2)
|
||||
|
||||
pipe := func(dst io.Writer, src io.Reader) {
|
||||
pipe := func(dst io.WriteCloser, src io.Reader) {
|
||||
_, err := io.Copy(dst, src)
|
||||
if err != nil && err != io.EOF {
|
||||
log.Debugf("stream error: %s", err.Error())
|
||||
s.Reset()
|
||||
}
|
||||
dst.Close()
|
||||
wg.Done()
|
||||
}
|
||||
|
||||
|
@ -26,7 +27,6 @@ func (d *Daemon) doStreamPipe(c net.Conn, s inet.Stream) {
|
|||
go pipe(s, c)
|
||||
|
||||
wg.Wait()
|
||||
s.Close()
|
||||
}
|
||||
|
||||
func (d *Daemon) handleStream(s inet.Stream) {
|
||||
|
|
Loading…
Reference in New Issue