コード例 #1
0
            // note that top-level error messages still get handled by SetResult, but nested errors
            // (is that a thing?) will be wrapped in the RedisResult
            protected override bool SetResultCore(PhysicalConnection connection, Message message, RawResult result)
            {
                switch (result.Type)
                {
                case ResultType.BulkString:
                    var asciiHash = result.GetBlob();
                    if (asciiHash == null || asciiHash.Length != 40)
                    {
                        return(false);
                    }

                    byte[] hash = null;
                    if (!message.IsInternalCall)
                    {
                        hash = ParseSHA1(asciiHash);     // external caller wants the hex bytes, not the ascii bytes
                    }
                    var sl = message as RedisDatabase.ScriptLoadMessage;
                    if (sl != null)
                    {
                        connection.Bridge.ServerEndPoint.AddScript(sl.Script, asciiHash);
                    }
                    SetResult(message, hash);
                    return(true);
                }
                return(false);
            }
コード例 #2
0
 protected override bool SetResultCore(PhysicalConnection connection, Message message, RawResult result)
 {
     switch (result.Type)
     {
     case ResultType.BulkString:
         SetResult(message, result.GetBlob());
         return(true);
     }
     return(false);
 }
コード例 #3
0
 // note that top-level error messages still get handled by SetResult, but nested errors
 // (is that a thing?) will be wrapped in the RedisResult
 protected override bool SetResultCore(PhysicalConnection connection, Message message, RawResult result)
 {
     switch (result.Type)
     {
     case ResultType.BulkString:
         var hash = result.GetBlob();
         var sl   = message as RedisDatabase.ScriptLoadMessage;
         if (sl != null)
         {
             connection.Bridge.ServerEndPoint.AddScript(sl.Script, hash);
         }
         SetResult(message, hash);
         return(true);
     }
     return(false);
 }