8000 this makes more sense as cleanup of serveLoop() · etherscan-io/sftp@161b43c · GitHub
[go: up one dir, main page]

Skip to content

Commit 161b43c

Browse files
committed
this makes more sense as cleanup of serveLoop()
1 parent e716c21 commit 161b43c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

request-server.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ func (rs *RequestServer) closeRequest(handle string) error {
107107
func (rs *RequestServer) Close() error { return rs.conn.Close() }
108108

109109
func (rs *RequestServer) serveLoop(pktChan chan<- orderedRequest) error {
110+
defer close(pktChan) // shuts down sftpServerWorkers
111+
110112
var err error
111113
var pkt requestPacket
112114
var pktType uint8
@@ -158,8 +160,7 @@ func (rs *RequestServer) Serve() error {
158160

159161
err := rs.serveLoop(pktChan)
160162

161-
close(pktChan) // shuts down sftpServerWorkers
162-
wg.Wait() // wait for all workers to exit
163+
wg.Wait() // wait for all workers to exit
163164

164165
rs.openRequestLock.Lock()
165166
defer rs.openRequestLock.Unlock()

0 commit comments

Comments
 (0)
0