@@ -30,6 +30,8 @@ private void InitDefaultValues()
3030 _keepAlivePingDelay = SocketHttpHandlerDefaults . DefaultKeepAlivePingSeconds ;
3131 _keepAlivePingTimeout = SocketHttpHandlerDefaults . DefaultKeepAlivePingTimeoutSeconds ;
3232 _enableMultipleHttp2Connections = false ;
33+ _maxSendMessageSize = SocketHttpHandlerDefaults . MaxSendMessageSize ;
34+ _maxReceiveMessageSize = SocketHttpHandlerDefaults . MaxReceiveMessageSize ;
3335 }
3436
3537 public string Host
@@ -187,6 +189,30 @@ public bool EnableMultipleHttp2Connections
187189
188190 private bool _enableMultipleHttp2Connections ;
189191
192+ public int MaxSendMessageSize
193+ {
194+ get => _maxSendMessageSize ;
195+ set
196+ {
197+ _maxSendMessageSize = value ;
198+ SaveValue ( nameof ( MaxSendMessageSize ) , value ) ;
199+ }
200+ }
201+
202+ private int _maxSendMessageSize ;
203+
204+ public int MaxReceiveMessageSize
205+ {
206+ get => _maxReceiveMessageSize ;
207+ set
208+ {
209+ _maxReceiveMessageSize = value ;
210+ SaveValue ( nameof ( MaxReceiveMessageSize ) , value ) ;
211+ }
212+ }
213+
214+ private int _maxReceiveMessageSize ;
215+
190216 public ILoggerFactory ? LoggerFactory { get ; init ; }
191217
192218 public ICredentialsProvider ? CredentialsProvider { get ; init ; }
@@ -235,24 +261,29 @@ internal Task<Driver> BuildDriver()
235261 {
236262 var cert = RootCertificate != null ? X509Certificate . CreateFromCertFile ( RootCertificate ) : null ;
237263
238- return Driver . CreateInitialized ( new DriverConfig (
239- endpoint : Endpoint ,
240- database : Database ,
241- credentials : CredentialsProvider ,
242- customServerCertificate : cert ,
243- customServerCertificates : ServerCertificates
244- )
245- {
246- KeepAlivePingDelay = KeepAlivePingDelay == 0
247- ? Timeout . InfiniteTimeSpan
248- : TimeSpan . FromSeconds ( KeepAlivePingDelay ) ,
249- KeepAlivePingTimeout = KeepAlivePingTimeout == 0
250- ? Timeout . InfiniteTimeSpan
251- : TimeSpan . FromSeconds ( KeepAlivePingTimeout ) ,
252- User = User ,
253- Password = Password ,
254- EnableMultipleHttp2Connections = EnableMultipleHttp2Connections
255- } , LoggerFactory ) ;
264+ return Driver . CreateInitialized (
265+ new DriverConfig (
266+ endpoint : Endpoint ,
267+ database : Database ,
268+ credentials : CredentialsProvider ,
269+ customServerCertificate : cert ,
270+ customServerCertificates : ServerCertificates
271+ )
272+ {
273+ KeepAlivePingDelay = KeepAlivePingDelay == 0
274+ ? Timeout . InfiniteTimeSpan
275+ : TimeSpan . FromSeconds ( KeepAlivePingDelay ) ,
276+ KeepAlivePingTimeout = KeepAlivePingTimeout == 0
277+ ? Timeout . InfiniteTimeSpan
278+ : TimeSpan . FromSeconds ( KeepAlivePingTimeout ) ,
279+ User = User ,
280+ Password = Password ,
281+ EnableMultipleHttp2Connections = EnableMultipleHttp2Connections ,
282+ MaxSendMessageSize = MaxSendMessageSize ,
283+ MaxReceiveMessageSize = MaxReceiveMessageSize
284+ } ,
285+ LoggerFactory
286+ ) ;
256287 }
257288
258289 public override void Clear ( )
@@ -333,6 +364,11 @@ static YdbConnectionOption()
333364 AddOption ( new YdbConnectionOption < bool > ( BoolExtractor , ( builder , enableMultipleHttp2Connections ) =>
334365 builder . EnableMultipleHttp2Connections = enableMultipleHttp2Connections ) ,
335366 "EnableMultipleHttp2Connections" , "Enable Multiple Http2 Connections" ) ;
367+ AddOption ( new YdbConnectionOption < int > ( IntExtractor , ( builder , maxSendMessageSize ) =>
368+ builder . MaxSendMessageSize = maxSendMessageSize ) , "MaxSendMessageSize" , "Max Send Message Size" ) ;
369+ AddOption ( new YdbConnectionOption < int > ( IntExtractor , ( builder , maxReceiveMessageSize ) =>
370+ builder . MaxReceiveMessageSize = maxReceiveMessageSize ) ,
371+ "MaxReceiveMessageSize" , "Max Receive Message Size" ) ;
336372 }
337373
338374 private static void AddOption ( YdbConnectionOption option , params string [ ] keys )
0 commit comments