@@ -248,22 +248,15 @@ protected bool SendCommand(params byte[][] cmdWithBinaryArgs)
248248 if ( __requestsPerHour % 20 == 0 )
249249 LicenseUtils . AssertValidUsage ( LicenseFeature . Redis , QuotaType . RequestsPerHour , __requestsPerHour ) ;
250250
251- try
252- {
253- CmdLog ( cmdWithBinaryArgs ) ;
251+ CmdLog ( cmdWithBinaryArgs ) ;
254252
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 ( ) ;
257259
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- }
267260 return true ;
268261 }
269262
@@ -320,25 +313,34 @@ private void PushCurrentBuffer()
320313 currentBufferIndex = 0 ;
321314 }
322315
323- public void FlushSendBuffer ( )
316+ public bool FlushSendBuffer ( )
324317 {
325- if ( currentBufferIndex > 0 )
326- PushCurrentBuffer ( ) ;
327-
328- if ( ! Env . IsMono )
329- {
330- socket . Send ( cmdBuffer ) ; //Optimized for Windows
331- }
332- else
318+ try
333319 {
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
336328 {
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+ }
339335 }
336+ ResetSendBuffer ( ) ;
340337 }
341- ResetSendBuffer ( ) ;
338+ catch ( SocketException ex )
339+ {
340+ cmdBuffer . Clear ( ) ;
341+ return HandleSocketException ( ex ) ;
342+ }
343+ return true ;
342344 }
343345
344346 /// <summary>
0 commit comments