Beispiel #1
0
        public static bool IsHasErrorRequest(MongoStandardMessage message)
        {
            if (message.GetType() == typeof (MongoQueryMessage))
            {
                var query = (MongoQueryMessage) message;

                return query.Document.Contains("getlasterror");
            }

            return false;
        }
Beispiel #2
0
 public static bool IsHasError(MongoStandardMessage message)
 {
     if (message.GetType() == typeof (MongoReplyMessage))
     {
         var reply = (MongoReplyMessage) message;
         var document = reply.Documents.FirstOrDefault();
         if (document != null)
         {
             if (document.Contains("ok") && document.Contains("err") &&
                 document["ok"] == 1.0)
             {
                 return false;
             }
         }
     }
     //TODO : throw suit.. ex
     throw new Exception("it is not good message");
 }
Beispiel #3
0
 private void SendRequestToServer(MongoStandardMessage clientRequest)
 {
     _mongo.Send(clientRequest.RawRequest);
 }
Beispiel #4
0
 private void SendResponseToClient(MongoStandardMessage response)
 {
     _client.Send(response.RawRequest);
 }
Beispiel #5
0
        private void HandleRequest( MongoStandardMessage request )
        {
            _querySynchronizer.StartAction();
            try
            {
                _mongo.Send( request.RawRequest );
            }
            finally
            {
                _querySynchronizer.StopAction();
            }

            if ( request.WaitForResponse() )
            {
                SendResponseToClient( ReadServerResponse() );
            }
        }