History

GSF.ServiceProcess: In ClientHelper, fixed invalid authentication failures due to a short client-side timeout.

StephenCWills committed 8 years ago

Commit 276a58a1 parent 4a4c6ef6 files · +144 −129Browse files

Showing the changes to Source/Libraries/GSF.ServiceProcess/ClientHelper.cs (1 of 6 files). Show all

Unified · Split

Source/Libraries/GSF.ServiceProcess/ClientHelper.cs+9−14
@@ -540,18 +540,17 @@ namespace GSF.ServiceProcess · 539 unmodified lines
540540 /// </summary>
541541 public void Connect()
542542 {
543− if ((object)m_remotingClient == null)
543+ ClientBase remotingClient = m_remotingClient;
544+
545+ if ((object)remotingClient == null)
544546 throw new InvalidOperationException("RemotingClient property of ClientHelper component is not set");
545547
546548 m_authenticationComplete = false;
547549
548550 // Wait for connection.
549− m_remotingClient.Connect();
550−
551− const int MaxWaitPeriods = 50; // Will wait a maximum of 5 seconds before assuming failure
552− int attempts = 0;
551+ remotingClient.Connect();
553552
554− while (!m_authenticationComplete && m_remotingClient.Enabled && attempts++ < MaxWaitPeriods)
553+ while (remotingClient.Enabled && !m_authenticationComplete)
555554 {
556555 // Wait for authentication.
557556 Thread.Sleep(100);
@@ -561,14 +560,10 @@ namespace GSF.ServiceProcess · 3 unmodified lines
561560 return;
562561 }
563562
564− // It is possible that local domain account will not be accepted and/or recognized by remote
565− // server when attempting to use integrated security - in these cases the sent client info
566− // message can be rejected so the ServiceHelper will neither respond with success or failure.
567− // We treat this as an authentication failure so that credentials can be requested.
568− if (attempts >= MaxWaitPeriods)
569− OnAuthenticationFailure();
563+ if (!m_authenticationComplete)
564+ UpdateStatus(UpdateType.Alarm, "Connection was terminated before completing authentication.\r\n\r\n");
570565
571− if (m_remotingClient.Enabled)
566+ if (remotingClient.Enabled)
572567 m_attemptReconnection = true;
573568 }
574569
@@ -777,7 +772,6 @@ namespace GSF.ServiceProcess · 202 unmodified lines
777772 status.Append(m_remotingClient.Status);
778773 status.AppendLine();
779774 UpdateStatus(UpdateType.Information, "{0}", status.ToString());
780− SendRequest(StatusMessageFilter);
781775 }
782776
783777 private void RemotingClient_ConnectionException(object sender, EventArgs<Exception> e)
@@ -848,6 +842,7 @@ namespace GSF.ServiceProcess · 64 unmodified lines
848842 UpdateStatus(UpdateType.Alarm, "{0}", response.Message);
849843 break;
850844 case "AUTHENTICATIONSUCCESS":
845+ SendRequest(StatusMessageFilter);
851846 OnAuthenticationSuccess();
852847 break;
853848 case "AUTHENTICATIONFAILURE":

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t