All files / src/Ice OutgoingAsync.js

90.76% Statements 531/585
88.96% Branches 129/145
94.28% Functions 33/35
90.76% Lines 531/585

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 58641x 41x 41x 41x 41x 41x 41x 41x 41x 41x 41x 41x 41x 41x 41x 41x 41x 41x 41x 41x 41x 41x 41x 41x 41x 41x 41x 41x 41x 41x 41x 41x 41x 41x 41x 41x 41x 41x 41x 41x 41x 41x 41x 41x 3803x 3803x 3803x 3803x 3803x 3803x 41x 41x 4969x 4969x 41x 41x 27x 27x 41x 41x     41x 41x 41x 41x 3789x 3789x 3789x 3789x 3789x 3789x 41x 41x 2128x 2128x 2128x 2128x 1089x 1089x 2128x 41x 41x                       41x 41x 1038x 1038x 41x 41x 22x 22x 41x 41x 4745x 4745x 3707x 3707x 7x 4x 7x 7x 3707x 4745x 4745x 4796x 4796x 4796x 4796x 1172x 1172x 4744x 4796x 52x 51x 51x 52x 1x 1x       1x 52x 4796x 4745x 1x 1x 4745x 41x 41x 2457x 2457x 24x     24x 2457x 2457x 41x 41x 1112x 5x 5x 1112x 1112x 41x 41x 2129x 2129x 2129x 2129x 2129x 2129x 2129x 2129x 2129x 2129x 2129x 2129x 2129x 2129x 2129x 2129x 2129x 2129x 2129x 2129x 2129x 2129x 2101x 2101x 2101x 1062x     1062x 1062x 2129x 28x 28x 2129x 41x 41x 2101x 2101x 2101x 2101x 2101x 2101x 2101x 2101x 1x 1x 2100x 2100x 2100x 2101x     2100x 2101x 26x                     26x 3x 3x 3x 3x 3x 3x 3x 26x 23x 23x 23x 2101x 4x 4x 2073x 2073x 2073x 2073x 2073x 2073x 2073x 2073x 2073x 2073x 2073x 2073x 2073x 2081x     2073x 2073x 2073x 2073x 2101x 2101x 2073x 2101x     2073x 2073x 2101x 4x 4x 2069x 2069x 2069x 2069x 2069x 2069x 2069x 2101x     2077x 1030x 11x 11x 11x 11x 11x 1030x 2059x 1039x 1039x 1039x 2062x 17x 17x 5x 5x 17x 17x 17x 1039x 1039x 2101x 41x 41x 41x 41x 3537x 3537x 3537x 3537x 3537x 3537x 41x 41x 3537x 3537x 1x 1x 1x 1x 3536x 3536x 3537x     3536x 3537x 60x 3537x 3476x 3476x 3536x 3536x 3536x 3536x 3536x 3536x 3536x 3536x 3536x 3537x 3513x 3537x 23x 23x 3536x 3536x 3536x 3536x 3536x 3537x 13x     13x 13x 13x 13x 13x 3537x 3523x 3523x 3523x 3523x 3523x 3523x 3523x 3515x 3523x 8x 8x 3523x 3537x 41x 41x 2444x 2444x 41x 41x 2496x 2496x 41x 41x 22x     22x 22x 41x 41x 3515x 60x 60x 60x 60x 60x 3455x 3455x 3455x 3455x 3455x 3455x 3455x 3515x 41x 41x 2419x 2419x 2419x 2419x 2409x 2409x 2409x 2419x 2419x 2419x 2419x 2419x 2419x 2419x 2419x 2419x 2357x 2419x 2419x 2419x 2419x 33x 33x 33x 33x 33x 33x 33x 33x 33x 2x         2x 33x 31x 31x 33x 33x 33x 33x 33x 26x 33x 4x 33x 3x 33x 33x 2419x 2419x 29x 29x 29x 7x 29x 18x 29x 2x 29x 2x 29x 29x 2419x 2357x 2357x 2419x 62x 62x 2419x 41x 41x 732x 732x 732x 41x 41x 712x 712x 41x 41x 2804x 2804x 41x 41x 981x 981x 981x 41x 41x 979x 979x 41x 41x 1310x 1310x 41x 41x 2357x 2357x 66x 66x 66x 66x 66x 66x 66x 66x 66x 66x 2357x 41x 41x 41x 41x 41x 41x 41x 13x 13x 13x 41x 41x 14x 5x 5x 5x 9x 14x 41x 41x 13x 13x         13x 13x 41x 41x 41x 41x 236x 236x 236x 41x 41x 239x 239x 41x 41x 41x 41x 14x 14x 14x 41x 41x 14x 14x 14x 14x 9x 9x 14x 5x 5x 14x 14x 14x 14x 14x     14x 41x  
// Copyright (c) ZeroC, Inc.
 
import { OutputStream } from "./OutputStream.js";
import { AsyncResult } from "./AsyncResult.js";
import { AsyncStatus } from "./AsyncStatus.js";
import { UserException } from "./UserException.js";
import { RetryException } from "./RetryException.js";
import { ReferenceMode } from "./ReferenceMode.js";
import { Ice as Ice_OperationMode } from "./OperationMode.js";
const { OperationMode } = Ice_OperationMode;
import {
    DispatchException,
    CloseConnectionException,
    ConnectionClosedException,
    CommunicatorDestroyedException,
    ConnectionAbortedException,
    FacetNotExistException,
    FeatureNotSupportedException,
    InvocationCanceledException,
    InvocationTimeoutException,
    MarshalException,
    ObjectAdapterDestroyedException,
    ObjectNotExistException,
    OperationNotExistException,
    RequestFailedException,
    UnknownException,
    UnknownLocalException,
    UnknownUserException,
} from "./LocalExceptions.js";
import { LocalException } from "./LocalException.js";
import { Ice as Ice_Context } from "./Context.js";
const { ContextHelper } = Ice_Context;
import { Protocol } from "./Protocol.js";
import { Ice as Ice_BuiltinSequences } from "./BuiltinSequences.js";
const { StringSeqHelper } = Ice_BuiltinSequences;
import { InputStream } from "./InputStream.js";
 
import { Ice as Ice_Identity } from "./Identity.js";
const { Identity } = Ice_Identity;
import { Ice as Ice_ReplyStatus } from "./ReplyStatus.js";
const { ReplyStatus } = Ice_ReplyStatus;
 
export class OutgoingAsyncBase extends AsyncResult {
    constructor(communicator, operation, proxy) {
        super(communicator, operation, proxy);
        this._os = new OutputStream(
            Protocol.currentProtocolEncoding,
            this._instance.defaultsAndOverrides().defaultFormat,
        );
    }
 
    getOs() {
        return this._os;
    }
 
    sent() {
        this.markSent(true);
    }
 
    exception(ex) {
        return this.markFinishedEx(ex);
    }
}
 
export class ProxyOutgoingAsyncBase extends OutgoingAsyncBase {
    constructor(prx, operation) {
        super(prx.ice_getCommunicator(), operation, prx);
        this._mode = null;
        this._cnt = 0;
        this._sent = false;
        this._handler = null;
    }
 
    completedEx(ex) {
        try {
            const interval = this.handleRetryAfterException(ex);
            this._instance.retryQueue().add(this, interval);
        } catch (ex) {
            this.markFinishedEx(ex);
        }
    }
 
    retryException() {
        try {
            // It's important to let the retry queue do the retry. This is
            // called from the connect request handler and the retry might
            // require could end up waiting for the flush of the
            // connection to be done.
            this._proxy._requestHandlerCache.clearCachedRequestHandler(this._handler);
            this._instance.retryQueue().add(this, 0);
        } catch (ex) {
            this.completedEx(ex);
        }
    }
 
    retry() {
        this.invokeImpl(false);
    }
 
    abort(ex) {
        this.markFinishedEx(ex);
    }
 
    invokeImpl(userThread) {
        try {
            if (userThread) {
                const invocationTimeout = this._proxy._getReference().getInvocationTimeout();
                if (invocationTimeout > 0) {
                    this._timeoutToken = this._instance.timer().schedule(() => {
                        this.cancelWithException(new InvocationTimeoutException());
                    }, invocationTimeout);
                }
            }
 
            while (true) {
                try {
                    this._sent = false;
                    this._handler = this._proxy._requestHandlerCache.requestHandler;
                    if ((this._handler.sendAsyncRequest(this) & AsyncStatus.Sent) > 0 && userThread) {
                        this._sentSynchronously = true;
                    }
                    return; // We're done!
                } catch (ex) {
                    if (ex instanceof RetryException) {
                        // Clear request handler and always retry
                        this._proxy._requestHandlerCache.clearCachedRequestHandler(this._handler);
                    } else {
                        const interval = this.handleRetryAfterException(ex);
                        if (interval > 0) {
                            this._instance.retryQueue().add(this, interval);
                            return;
                        }
                    }
                }
            }
        } catch (ex) {
            this.markFinishedEx(ex);
        }
    }
 
    markSent(done) {
        this._sent = true;
        if (done) {
            if (this._timeoutToken) {
                this._instance.timer().cancel(this._timeoutToken);
            }
        }
        super.markSent.call(this, done);
    }
 
    markFinishedEx(ex) {
        if (this._timeoutToken) {
            this._instance.timer().cancel(this._timeoutToken);
        }
        super.markFinishedEx.call(this, ex);
    }
 
    handleRetryAfterException(ex) {
        // Clear the request handler
        this._proxy._requestHandlerCache.clearCachedRequestHandler(this._handler);
 
        // We only retry local exception.
        //
        // A CloseConnectionException indicates graceful server shutdown, and is therefore always repeatable without
        // violating "at-most-once". That's because by sending a close connection message, the server guarantees that
        // all outstanding requests can safely be repeated.
        //
        // An ObjectNotExistException can always be retried as well without violating "at-most-once" (see the
        // implementation of the checkRetryAfterException method below for the reasons why it can be useful).
        //
        // If the request didn't get sent or if it's non-mutating or idempotent it can also always be retried if the
        // retry count isn't reached.
        if (
            ex instanceof LocalException &&
            (!this._sent ||
                this._mode == OperationMode.Nonmutating ||
                this._mode == OperationMode.Idempotent ||
                ex instanceof CloseConnectionException ||
                ex instanceof ObjectNotExistException)
        ) {
            try {
                return this.checkRetryAfterException(ex);
            } catch (e) {
                if (e instanceof CommunicatorDestroyedException) {
                    throw ex; // The communicator is already destroyed, so we cannot retry.
                }
                throw e;
            }
        } else {
            throw ex; // Retry could break at-most-once semantics, don't retry.
        }
    }
 
    checkRetryAfterException(ex) {
        const ref = this._proxy._reference;
        const instance = ref.getInstance();
        const traceLevels = instance.traceLevels();
        const logger = instance.initializationData().logger;
 
        // We don't retry batch requests because the exception might have caused that all the requests batched with the
        // connection to be aborted and we want the application to be notified.
        if (ref.getMode() == ReferenceMode.ModeBatchOneway) {
            throw ex;
        }
 
        // If it's a fixed proxy, retrying isn't useful as the proxy is tied to the connection and the request will
        // fail with the exception.
        if (ref.isFixed()) {
            throw ex;
        }
 
        if (ex instanceof ObjectNotExistException) {
            if (ref.getRouterInfo() != null && ex.operation == "ice_add_proxy") {
                // If we have a router, an ObjectNotExistException with an operation name "ice_add_proxy" indicates to
                // the client that the router isn't aware of the proxy (for example, because it was evicted by the
                // router). In this case, we must *always* retry, so that the missing proxy is added to the router.
                ref.getRouterInfo().clearCache(ref);

                if (traceLevels.retry >= 1) {
                    logger.trace(traceLevels.retryCat, "retrying operation call to add proxy to router\n" + ex);
                }
                // We must always retry, so we don't look at the retry count.
                return 0;
            } else if (ref.isIndirect()) {
                // We retry ObjectNotExistException if the reference is indirect.
                if (ref.isWellKnown()) {
                    const li = ref.getLocatorInfo();
                    if (li !== null) {
                        li.clearCache(ref);
                    }
                }
            } else {
                // For all other cases, we don't retry ObjectNotExistException.
                throw ex;
            }
        } else if (ex instanceof RequestFailedException) {
            throw ex;
        }
 
        // There is no point in retrying an operation that resulted in a MarshalException. This must have been raised
        // locally (because if it happened in a server it would result in an UnknownLocalException  instead), which
        // means there was a problem in this process that will not change if we try again.
        //
        // A likely cause for a MarshalException is exceeding the maximum message size. For example, a client
        // can attempt to send a message that exceeds the maximum memory size, or accumulate enough batch requests
        // without flushing before the maximum size is reached.
        //
        // This latter case is especially problematic, because if we were to retry a batch request after a
        // MarshalException, we would in fact silently discard the accumulated requests and allow new batch requests to
        // accumulate. If the subsequent batched requests do not exceed the maximum message size, it appears to the
        // client that all of the batched requests were accepted, when in reality only the last few are actually sent.
        if (ex instanceof MarshalException) {
            throw ex;
        }
 
        // Don't retry if the communicator is destroyed, object adapter is destroyed, or connection is manually closed.
        if (
            ex instanceof CommunicatorDestroyedException ||
            ex instanceof ObjectAdapterDestroyedException ||
            (ex instanceof ConnectionAbortedException && ex.closedByApplication) ||
            (ex instanceof ConnectionClosedException && ex.closedByApplication)
        ) {
            throw ex;
        }
 
        // Don't retry invocation timeouts.
        if (ex instanceof InvocationTimeoutException || ex instanceof InvocationCanceledException) {
            throw ex;
        }
 
        ++this._cnt;
        console.assert(this._cnt > 0);
 
        const retryIntervals = instance._retryIntervals;
 
        let interval = 0;
        if (this._cnt == retryIntervals.length + 1 && ex instanceof CloseConnectionException) {
            // A close connection exception is always retried at least once, even if the retry limit is reached.
            interval = 0;
        } else if (this._cnt > retryIntervals.length) {
            if (traceLevels.retry >= 1) {
                logger.trace(
                    traceLevels.retryCat,
                    "cannot retry operation call because retry limit has been exceeded\n" + ex,
                );
            }
            throw ex;
        } else {
            interval = retryIntervals[this._cnt - 1];
        }
 
        if (traceLevels.retry >= 1) {
            let s = "retrying operation call";
            if (interval > 0) {
                s += " in " + interval + "ms";
            }
            s += " because of exception\n" + ex;
            logger.trace(traceLevels.retryCat, s);
        }
 
        return interval;
    }
}
 
export class OutgoingAsync extends ProxyOutgoingAsyncBase {
    constructor(prx, operation, completed) {
        super(prx, operation);
        if (prx) {
            this._encoding = Protocol.getCompatibleEncoding(this._proxy._getReference().getEncoding());
            this._completed = completed;
        }
    }
 
    prepare(mode, ctx) {
        const protocol = this._proxy._getReference().getProtocol();
        if (protocol.major != Protocol.currentProtocol.major) {
            throw new FeatureNotSupportedException(
                `Cannot send request using protocol version ${protocol.major}.${protocol.minor}`,
            );
        }
 
        this._mode = mode;
        if (ctx === null) {
            ctx = OutgoingAsync._emptyContext;
        }
 
        if (this._proxy.ice_isBatchOneway()) {
            this._proxy._reference.batchRequestQueue.prepareBatchRequest(this._os);
        } else {
            this._os.writeBlob(Protocol.requestHdr);
        }
 
        const ref = this._proxy._getReference();
 
        ref.getIdentity()._write(this._os);
 
        //
        // For compatibility with the old FacetPath.
        //
        const facet = ref.getFacet();
        if (facet === null || facet.length === 0) {
            StringSeqHelper.write(this._os, null);
        } else {
            StringSeqHelper.write(this._os, [facet]);
        }
 
        this._os.writeString(this._operation);
 
        this._os.writeByte(mode.value);
 
        if (ctx !== undefined) {
            if (ctx !== null && !(ctx instanceof Map)) {
                throw new RangeError("illegal context value, expecting null or Map");
            }
 
            //
            // Explicit context
            //
            ContextHelper.write(this._os, ctx);
        } else {
            //
            // Implicit context
            //
            const implicitContext = ref.getInstance().getImplicitContext();
            const prxContext = ref.getContext();
 
            if (implicitContext === null) {
                ContextHelper.write(this._os, prxContext);
            } else {
                implicitContext.write(prxContext, this._os);
            }
        }
    }
 
    sent() {
        this.markSent(!this._proxy.ice_isTwoway());
    }
 
    invokeRemote(connection, response) {
        return connection.sendAsyncRequest(this, response, 0);
    }
 
    abort(ex) {
        if (this._proxy.ice_isBatchOneway()) {
            this._proxy._reference.batchRequestQueue.abortBatchRequest(this._os);
        }
        super.abort(ex);
    }
 
    invoke() {
        if (this._proxy.ice_isBatchOneway()) {
            this._sentSynchronously = true;
            this._proxy._reference.batchRequestQueue.finishBatchRequest(this._os, this._proxy, this._operation);
            this.markFinished(true);
            return;
        }
 
        //
        // NOTE: invokeImpl doesn't throw so this can be called from the
        // try block with the catch block calling abort() in case of an
        // exception.
        //
        this.invokeImpl(true); // userThread = true
    }
 
    completed(istr) {
        console.assert(this._proxy.ice_isTwoway()); // Can only be called for twoways.
 
        try {
            if (this._is === null) {
                // _is can already be initialized if the invocation is retried
                this._is = new InputStream(this._instance, Protocol.currentProtocolEncoding);
            }
            this._is.swap(istr);
 
            // We can't (shouldn't) use the generated code to unmarshal a possibly unknown reply status.
            // This creates a new enumerator (e.g. "18": 18) if one doesn't exist yet.
            const replyStatus = ReplyStatus.valueOf(this._is.readByte());
 
            switch (replyStatus) {
                case ReplyStatus.Ok:
                case ReplyStatus.UserException:
                    break;
 
                case ReplyStatus.ObjectNotExist:
                case ReplyStatus.FacetNotExist:
                case ReplyStatus.OperationNotExist: {
                    const id = new Identity();
                    id._read(this._is);
 
                    //
                    // For compatibility with the old facet path.
                    //
                    const facetPath = StringSeqHelper.read(this._is);
                    let facet;
                    if (facetPath.length > 0) {
                        if (facetPath.length > 1) {
                            throw new MarshalException(
                                `Received invalid facet path with ${facetPath.length} elements.`,
                            );
                        }
                        facet = facetPath[0];
                    } else {
                        facet = "";
                    }
 
                    const operation = this._is.readString();
 
                    switch (replyStatus) {
                        case ReplyStatus.ObjectNotExist:
                            throw new ObjectNotExistException(id, facet, operation);
                        case ReplyStatus.FacetNotExist:
                            throw new FacetNotExistException(id, facet, operation);
                        default:
                            throw new OperationNotExistException(id, facet, operation);
                    }
                }
 
                default: {
                    const message = this._is.readString();
                    switch (replyStatus) {
                        case ReplyStatus.UnknownException:
                            throw new UnknownException(message);
                        case ReplyStatus.UnknownLocalException:
                            throw new UnknownLocalException(message);
                        case ReplyStatus.UnknownUserException:
                            throw new UnknownUserException(message);
                        default:
                            throw new DispatchException(replyStatus, message);
                    }
                }
            }
 
            this.markFinished(replyStatus == ReplyStatus.Ok, this._completed);
        } catch (ex) {
            this.completedEx(ex);
        }
    }
 
    startWriteParams(format) {
        this._os.startEncapsulation(this._encoding, format);
        return this._os;
    }
 
    endWriteParams() {
        this._os.endEncapsulation();
    }
 
    writeEmptyParams() {
        this._os.writeEmptyEncapsulation(this._encoding);
    }
 
    startReadParams() {
        this._is.startEncapsulation();
        return this._is;
    }
 
    endReadParams() {
        this._is.endEncapsulation();
    }
 
    readEmptyParams() {
        this._is.skipEmptyEncapsulation();
    }
 
    throwUserException() {
        console.assert((this._state & AsyncResult.Done) !== 0);
        if ((this._state & AsyncResult.Ok) === 0) {
            try {
                this._is.startEncapsulation();
                this._is.throwException();
            } catch (ex) {
                if (ex instanceof UserException) {
                    this._is.endEncapsulation();
                }
                throw ex;
            }
        }
    }
}
 
// TODO: We should use an immutable map.
OutgoingAsync._emptyContext = new Map(); // Map<string, string>
 
export class ProxyFlushBatch extends ProxyOutgoingAsyncBase {
    constructor(prx, operation) {
        super(prx, operation);
        this._batchRequestNum = prx._reference.batchRequestQueue.swap(this._os);
    }
 
    invokeRemote(connection, response) {
        if (this._batchRequestNum === 0) {
            this.sent();
            return AsyncStatus.Sent;
        }
        return connection.sendAsyncRequest(this, response, this._batchRequestNum);
    }
 
    invoke() {
        const protocol = this._proxy._getReference().getProtocol();
        if (protocol.major != Protocol.currentProtocol.major) {
            throw new FeatureNotSupportedException(
                `Cannot send request using protocol version ${protocol.major}.${protocol.minor}`,
            );
        }
        this.invokeImpl(true); // userThread = true
    }
}
 
export class ProxyGetConnection extends ProxyOutgoingAsyncBase {
    invokeRemote(connection) {
        this.markFinished(true, r => r.resolve(connection));
        return AsyncStatus.Sent;
    }
 
    invoke() {
        this.invokeImpl(true); // userThread = true
    }
}
 
export class ConnectionFlushBatch extends OutgoingAsyncBase {
    constructor(connection, communicator, operation) {
        super(communicator, operation);
        this._connection = connection;
    }
 
    invoke() {
        try {
            const batchRequestNum = this._connection.getBatchRequestQueue().swap(this._os);
            let status;
            if (batchRequestNum === 0) {
                this.sent();
                status = AsyncStatus.Sent;
            } else {
                status = this._connection.sendAsyncRequest(this, false, batchRequestNum);
            }
 
            if ((status & AsyncStatus.Sent) > 0) {
                this._sentSynchronously = true;
            }
        } catch (ex) {
            this.markFinishedEx(ex);
        }
    }
}