Example #1
0
        private void IFetchNode()
        {
            pnCli2Vault_NodeFetch req = new pnCli2Vault_NodeFetch();
            req.Read(fStream);

            pnVault2Cli_NodeFetched reply = new pnVault2Cli_NodeFetched();
            reply.fResult = ENetError.kNetSuccess;
            reply.fTransID = req.fTransID;

            pnSqlSelectStatement select = new pnSqlSelectStatement();
            select.AddWhere("NodeIdx", req.fNodeID);
            select.Limit = 1;
            select.Table = "Nodes";
            try {
                IDataReader r = select.Execute(fDb);
                if (r.Read())
                    reply.fNode = IMakeNode(r);
                else
                    reply.fResult = ENetError.kNetErrVaultNodeNotFound;
                r.Close();
            } catch (pnDbException e) {
                Error(e, "Failed to fetch node #" + req.fNodeID.ToString());
                reply.fResult = ENetError.kNetErrInternalError;
            }

            reply.Send(fStream);
        }
Example #2
0
        public void FetchNode(uint nodeID, pnCallback cb = null)
        {
            pnCli2Vault_NodeFetch req = new pnCli2Vault_NodeFetch();
            req.fNodeID = nodeID;
            req.fTransID = GetTransID();

            lock (fStream) {
                if (cb != null)
                    fCallbacks.Add(req.fTransID, cb);
                req.Send(fStream);
            }
        }