You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: clientconn.go
+41-17Lines changed: 41 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -88,30 +88,45 @@ var (
88
88
// dialOptions configure a Dial call. dialOptions are set by the DialOption
89
89
// values passed to Dial.
90
90
typedialOptionsstruct {
91
-
unaryIntUnaryClientInterceptor
92
-
streamIntStreamClientInterceptor
93
-
codecCodec
94
-
cpCompressor
95
-
dcDecompressor
96
-
bsbackoffStrategy
97
-
balancerBalancer
98
-
blockbool
99
-
insecurebool
100
-
timeout time.Duration
101
-
scChan<-chanServiceConfig
102
-
copts transport.ConnectOptions
103
-
maxMsgSizeint
91
+
unaryIntUnaryClientInterceptor
92
+
streamIntStreamClientInterceptor
93
+
codecCodec
94
+
cpCompressor
95
+
dcDecompressor
96
+
bsbackoffStrategy
97
+
balancerBalancer
98
+
blockbool
99
+
insecurebool
100
+
timeout time.Duration
101
+
scChan<-chanServiceConfig
102
+
copts transport.ConnectOptions
103
+
maxReceiveMessageSizeint
104
+
maxSendMessageSizeint
104
105
}
105
106
106
107
constdefaultClientMaxMsgSize=math.MaxInt32
107
108
108
109
// DialOption configures how we set up the connection.
109
110
typeDialOptionfunc(*dialOptions)
110
111
111
-
// WithMaxMsgSize returns a DialOption which sets the maximum message size the client can receive.
112
+
// WithMaxMsgSize returns a DialOption which sets the maximum message size the client can receive. This function is for backward API compatibility. It has essentially the same functionality as WithMaxReceiveMessageSize.
112
113
funcWithMaxMsgSize(sint) DialOption {
113
114
returnfunc(o*dialOptions) {
114
-
o.maxMsgSize=s
115
+
o.maxReceiveMessageSize=s
116
+
}
117
+
}
118
+
119
+
// WithMaxReceiveMessageSize returns a DialOption which sets the maximum message size the client can receive. Negative input is invalid and has the same effect as not setting the field.
120
+
funcWithMaxReceiveMessageSize(sint) DialOption {
121
+
returnfunc(o*dialOptions) {
122
+
o.maxReceiveMessageSize=s
123
+
}
124
+
}
125
+
126
+
// WithMaxSendMessageSize returns a DialOption which sets the maximum message size the client can send. Negative input is invalid and has the same effect as not seeting the field.
// initialize maxReceiveMessageSize and maxSendMessageSize to -1 before applying DialOption functions to distinguish whether the user set the message limit or not.
// GetMethodConfig gets the method config of the input method. If there's no exact match for the input method (i.e. /service/method), we will return the default config for all methods under the service (/service/).
0 commit comments