Merge branch 'master' of github.com:micro/go-micro
This commit is contained in:
		| @@ -74,7 +74,7 @@ var ( | |||||||
| 	// DefaultRequestTimeout is the default request timeout | 	// DefaultRequestTimeout is the default request timeout | ||||||
| 	DefaultRequestTimeout = time.Second * 5 | 	DefaultRequestTimeout = time.Second * 5 | ||||||
| 	// DefaultPoolSize sets the connection pool size | 	// DefaultPoolSize sets the connection pool size | ||||||
| 	DefaultPoolSize = 0 | 	DefaultPoolSize = 1 | ||||||
| 	// DefaultPoolTTL sets the connection pool ttl | 	// DefaultPoolTTL sets the connection pool ttl | ||||||
| 	DefaultPoolTTL = time.Minute | 	DefaultPoolTTL = time.Minute | ||||||
| ) | ) | ||||||
|   | |||||||
| @@ -66,6 +66,9 @@ func (s *rpcServer) accept(sock transport.Socket) { | |||||||
| 			return | 			return | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
|  | 		// add to wait group | ||||||
|  | 		s.wg.Add(1) | ||||||
|  |  | ||||||
| 		// we use this Timeout header to set a server deadline | 		// we use this Timeout header to set a server deadline | ||||||
| 		to := msg.Header["Timeout"] | 		to := msg.Header["Timeout"] | ||||||
| 		// we use this Content-Type header to identify the codec needed | 		// we use this Content-Type header to identify the codec needed | ||||||
| @@ -80,6 +83,7 @@ func (s *rpcServer) accept(sock transport.Socket) { | |||||||
| 				}, | 				}, | ||||||
| 				Body: []byte(err.Error()), | 				Body: []byte(err.Error()), | ||||||
| 			}) | 			}) | ||||||
|  | 			s.wg.Done() | ||||||
| 			return | 			return | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| @@ -102,15 +106,13 @@ func (s *rpcServer) accept(sock transport.Socket) { | |||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// add to wait group |  | ||||||
| 		s.wg.Add(1) |  | ||||||
| 		defer s.wg.Done() |  | ||||||
|  |  | ||||||
| 		// TODO: needs better error handling | 		// TODO: needs better error handling | ||||||
| 		if err := s.rpc.serveRequest(ctx, codec, ct); err != nil { | 		if err := s.rpc.serveRequest(ctx, codec, ct); err != nil { | ||||||
|  | 			s.wg.Done() | ||||||
| 			log.Logf("Unexpected error serving request, closing socket: %v", err) | 			log.Logf("Unexpected error serving request, closing socket: %v", err) | ||||||
| 			return | 			return | ||||||
| 		} | 		} | ||||||
|  | 		s.wg.Done() | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user