add timeout test, add check or pointer filed in callOption, fix minor issues

This commit is contained in:
Yuxuan Li
2017-05-15 13:51:11 -07:00
parent 59426b3c05
commit bdf9a640e4
6 changed files with 136 additions and 54 deletions

View File

@ -116,7 +116,6 @@ type options struct {
codec Codec
cp Compressor
dc Decompressor
maxMsgSize int
unaryInt UnaryServerInterceptor
streamInt StreamServerInterceptor
inTapHandle tap.ServerInHandle
@ -132,6 +131,8 @@ type options struct {
initialConnWindowSize int32
}
var defaultServerOptions = options{maxReceiveMessageSize: defaultServerMaxReceiveMessageSize, maxSendMessageSize: defaultServerMaxSendMessageSize}
// A ServerOption sets options such as credentials, codec and keepalive parameters, etc.
type ServerOption func(*options)
@ -284,9 +285,7 @@ func UnknownServiceHandler(streamHandler StreamHandler) ServerOption {
// NewServer creates a gRPC server which has no service registered and has not
// started to accept requests yet.
func NewServer(opt ...ServerOption) *Server {
var opts options
opts.maxReceiveMessageSize = defaultServerMaxReceiveMessageSize
opts.maxSendMessageSize = defaultServerMaxSendMessageSize
opts := defaultServerOptions
for _, o := range opt {
o(&opts)
}