private void OnErrorReceived(MemcachedCommand command)
        {
            RemoveFromPendingReceives(command);

            switch (command.ResponseStatus)
            {
                case ResponseStatus.VbucketBelongsToAnotherServer:
                case ResponseStatus.Busy:
                case ResponseStatus.TemporaryFailure:
                    {
                        var ev = OnRecoverableError;
                        if (ev != null)
                        {
                            ev(this.ServerId, command);
                        }
                    }
                    break;
                case ResponseStatus.NoError:
                    throw new Exception("Should be impossible to get here...");
                default:
                    //The error is not something we can deal with inside the library itself, either the caller screwed up, or there was a catastrophic failure.
                    command.NotifyComplete();
                    break;
            }
        }
        private static void SendByLinearlyPollingServers(Cluster cluster, string lastServerTriedToSendToId, MemcachedCommand command)
        {
            int indexOfServerToTry = GetIndexOfNextServerInCluster(cluster, lastServerTriedToSendToId);
            for (int i = 0; i < cluster.Servers.Count; i++)
            {
                if (cluster.Servers[indexOfServerToTry].TrySend(command))
                {
                    return;
                }

                indexOfServerToTry = MathUtils.CircularIncrement(indexOfServerToTry, cluster.Servers.Count);
            }

            command.NotifyComplete(ResponseStatus.DisconnectionOccuredWhileOperationWaitingToBeSent);
        }
 private void OnCommandResponseReceived(MemcachedCommand command)
 {
     RemoveFromPendingReceives(command);
     command.NotifyComplete();
 }
 private static void SendCommand(Cluster cluster, MemcachedCommand command)
 {
     if (!TrySendCommand(cluster, command))
     {
         command.NotifyComplete(ResponseStatus.DisconnectionOccuredWhileOperationWaitingToBeSent);
     }
 }