mirror of https://github.com/Xhofe/alist
				
				
				
			fix(net): close of closed channel (#7580)
							parent
							
								
									cf58ab3a78
								
							
						
					
					
						commit
						331885ed64
					
				| 
						 | 
				
			
			@ -169,9 +169,7 @@ func (d *downloader) sendChunkTask() *chunk {
 | 
			
		|||
 | 
			
		||||
// when the final reader Close, we interrupt
 | 
			
		||||
func (d *downloader) interrupt() error {
 | 
			
		||||
	if d.chunkChannel == nil {
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	d.cancel()
 | 
			
		||||
	if d.written != d.params.Range.Length {
 | 
			
		||||
		log.Debugf("Downloader interrupt before finish")
 | 
			
		||||
| 
						 | 
				
			
			@ -181,7 +179,6 @@ func (d *downloader) interrupt() error {
 | 
			
		|||
	}
 | 
			
		||||
	defer func() {
 | 
			
		||||
		close(d.chunkChannel)
 | 
			
		||||
		d.chunkChannel = nil
 | 
			
		||||
		for _, buf := range d.bufs {
 | 
			
		||||
			buf.Close()
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -174,7 +174,7 @@ func ServeHTTP(w http.ResponseWriter, r *http.Request, name string, modTime time
 | 
			
		|||
			pw.Close()
 | 
			
		||||
		}()
 | 
			
		||||
	}
 | 
			
		||||
	defer sendContent.Close()
 | 
			
		||||
	//defer sendContent.Close()
 | 
			
		||||
 | 
			
		||||
	w.Header().Set("Accept-Ranges", "bytes")
 | 
			
		||||
	if w.Header().Get("Content-Encoding") == "" {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue