internal virtual Response ReadResponse(Query query, long? deadline)
        {
            if( Socket == null )
                throw new ReqlError("Socket not open");

            long token = query.Token;

            while( true )
            {
                //may or maynot be the token we're looking for.
                var res = this.Socket.Read();

                ICursor cursor;
                if( cursorCache.TryGetValue(res.Token, out cursor) )
                {
                    cursor.Extend(res);
                    if( res.Token == token )
                    {
                        return null;
                    }
                }
                else if( res.Token == token )
                {
                    return res;
                }
                else if( !closing )
                {
                    Close();
                    throw new ReqlDriverError($"Unexpected response received: {res}");
                }
            }
        }
Esempio n. 2
0
		public virtual ErrorBuilder SetTerm(Query query)
		{
			this.Term = query.Term;
			return this;
		}
Esempio n. 3
0
 internal virtual ReqlError MakeError(Query query)
 {
     string msg = Data.Count > 0 ? (string)Data[0] : "Unknown error message";
     return (new ErrorBuilder(msg, Type)).SetBacktrace(Backtrace).SetErrorType(ErrorType).SetTerm(query).Build();
 }
Esempio n. 4
0
 internal virtual ReqlError MakeError(Query query)
 {
     string msg = this.Data.Count > 0 ? (string)Data[0] : "Unknown error message";
     return new ErrorBuilder(msg, this.Type)
         .SetBacktrace(this.Backtrace)
         .SetErrorType(this.ErrorType.GetValueOrDefault())
         .SetTerm(query)
         .Build();
 }
 internal virtual Response ReadResponse(Query query)
 {
     return ReadResponse(query, null);
 }