ignore net.ErrClosed
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
		
							
								
								
									
										5
									
								
								http.go
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								http.go
									
									
									
									
									
								
							@@ -4,6 +4,7 @@ package http // import "go.unistack.org/micro-server-http/v3"
 | 
				
			|||||||
import (
 | 
					import (
 | 
				
			||||||
	"context"
 | 
						"context"
 | 
				
			||||||
	"crypto/tls"
 | 
						"crypto/tls"
 | 
				
			||||||
 | 
						"errors"
 | 
				
			||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
	"net"
 | 
						"net"
 | 
				
			||||||
	"net/http"
 | 
						"net/http"
 | 
				
			||||||
@@ -496,13 +497,13 @@ func (h *httpServer) Start() error {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if srvFunc != nil {
 | 
						if srvFunc != nil {
 | 
				
			||||||
		go func() {
 | 
							go func() {
 | 
				
			||||||
			if cerr := srvFunc(ts); cerr != nil && !strings.Contains(cerr.Error(), "use of closed network connection") {
 | 
								if cerr := srvFunc(ts); cerr != nil && !errors.Is(cerr, net.ErrClosed) {
 | 
				
			||||||
				h.opts.Logger.Error(h.opts.Context, cerr)
 | 
									h.opts.Logger.Error(h.opts.Context, cerr)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}()
 | 
							}()
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		go func() {
 | 
							go func() {
 | 
				
			||||||
			if cerr := http.Serve(ts, fn); cerr != nil && !strings.Contains(cerr.Error(), "use of closed network connection") {
 | 
								if cerr := http.Serve(ts, fn); cerr != nil && !errors.Is(cerr, net.ErrClosed) {
 | 
				
			||||||
				h.opts.Logger.Error(h.opts.Context, cerr)
 | 
									h.opts.Logger.Error(h.opts.Context, cerr)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}()
 | 
							}()
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user