public CreateSessionRequest(string targetServer, bool polling, string cause, InternalConnectionOptions options, InternalConnectionDetails details, long delay, string password, string oldSession) : base(polling, delay) { this.Server = targetServer; this.addParameter("LS_polling", "true"); if (!string.ReferenceEquals(cause, null)) { this.addParameter("LS_cause", cause); } long requestedPollingInterval = 0; long requestedIdleTimeout = 0; if (polling) { // we ask this polling interval to the server, but the server might // refuse it and specify a smaller value // NOTE the client might even wait less than specified by the server: // we don't currently do that though requestedPollingInterval = options.PollingInterval + delay; } this.addParameter("LS_polling_millis", requestedPollingInterval); this.addParameter("LS_idle_millis", requestedIdleTimeout); this.addParameter("LS_cid", "jqWtj1twChtfDxikwp1ltvcB4CJ6Kj uWur8vy1sj.hm"); if (options.InternalMaxBandwidth == 0) { // unlimited: just omit the parameter } else if (options.InternalMaxBandwidth > 0) { this.addParameter("LS_requested_max_bandwidth", options.InternalMaxBandwidth); } if (!string.ReferenceEquals(details.AdapterSet, null)) { this.addParameter("LS_adapter_set", details.AdapterSet); } if (!string.ReferenceEquals(details.User, null)) { this.addParameter("LS_user", details.User); } if (!string.ReferenceEquals(password, null)) { this.addParameter("LS_password", password); } if (!string.ReferenceEquals(oldSession, null)) { this.addParameter("LS_old_session", oldSession); } log.Debug("Create Request: " + this.TargetServer); }
public RecoverSessionRequest(string targetServer, string session, string cause, InternalConnectionOptions options, long delay, long sessionRecoveryProg) : base(true, delay) { this.Server = targetServer; this.addParameter("LS_polling", "true"); if (!string.ReferenceEquals(cause, null)) { this.addParameter("LS_cause", cause); } long requestedPollingInterval = delay > 0 ? delay : 0; // NB delay can be negative since it is computed by SlowingHandler long requestedIdleTimeout = 0; this.addParameter("LS_polling_millis", requestedPollingInterval); this.addParameter("LS_idle_millis", requestedIdleTimeout); if (options.InternalMaxBandwidth == 0) { // unlimited: just omit the parameter } else if (options.InternalMaxBandwidth > 0) { this.addParameter("LS_requested_max_bandwidth", options.InternalMaxBandwidth); } Session = session; addParameter("LS_recovery_from", sessionRecoveryProg); }