@@ -248,22 +248,15 @@ protected bool SendCommand(params byte[][] cmdWithBinaryArgs)
248
248
if ( __requestsPerHour % 20 == 0 )
249
249
LicenseUtils . AssertValidUsage ( LicenseFeature . Redis , QuotaType . RequestsPerHour , __requestsPerHour ) ;
250
250
251
- try
252
- {
253
- CmdLog ( cmdWithBinaryArgs ) ;
251
+ CmdLog ( cmdWithBinaryArgs ) ;
254
252
255
- //Total command lines count
256
- WriteAllToSendBuffer ( cmdWithBinaryArgs ) ;
253
+ //Total command lines count
254
+ WriteAllToSendBuffer ( cmdWithBinaryArgs ) ;
255
+
256
+ //pipeline will handle flush, if pipelining is turned on
257
+ if ( Pipeline == null )
258
+ return FlushSendBuffer ( ) ;
257
259
258
- //pipeline will handle flush, if pipelining is turned on
259
- if ( Pipeline == null )
260
- FlushSendBuffer ( ) ;
261
- }
262
- catch ( SocketException ex )
263
- {
264
- cmdBuffer . Clear ( ) ;
265
- return HandleSocketException ( ex ) ;
266
- }
267
260
return true ;
268
261
}
269
262
@@ -320,25 +313,34 @@ private void PushCurrentBuffer()
320
313
currentBufferIndex = 0 ;
321
314
}
322
315
323
- public void FlushSendBuffer ( )
316
+ public bool FlushSendBuffer ( )
324
317
{
325
- if ( currentBufferIndex > 0 )
326
- PushCurrentBuffer ( ) ;
327
-
328
- if ( ! Env . IsMono )
329
- {
330
- socket . Send ( cmdBuffer ) ; //Optimized for Windows
331
- }
332
- else
318
+ try
333
319
{
334
- //Sendling IList<ArraySegment> Throws 'Message to Large' SocketException in Mono
335
- foreach ( var segment in cmdBuffer )
320
+ if ( currentBufferIndex > 0 )
321
+ PushCurrentBuffer ( ) ;
322
+
323
+ if ( ! Env . IsMono )
324
+ {
325
+ socket . Send ( cmdBuffer ) ; //Optimized for Windows
326
+ }
327
+ else
336
328
{
337
- var buffer = segment . Array ;
338
- socket . Send ( buffer , segment . Offset , segment . Count , SocketFlags . None ) ;
329
+ //Sendling IList<ArraySegment> Throws 'Message to Large' SocketException in Mono
330
+ foreach ( var segment in cmdBuffer )
331
+ {
332
+ var buffer = segment . Array ;
333
+ socket . Send ( buffer , segment . Offset , segment . Count , SocketFlags . None ) ;
334
+ }
339
335
}
336
+ ResetSendBuffer ( ) ;
340
337
}
341
- ResetSendBuffer ( ) ;
338
+ catch ( SocketException ex )
339
+ {
340
+ cmdBuffer . Clear ( ) ;
341
+ return HandleSocketException ( ex ) ;
342
+ }
343
+ return true ;
342
344
}
343
345
344
346
/// <summary>
0 commit comments