Showing the changes to Source/Libraries/GSF.ServiceProcess (1 of 6 files). Show all
Unified · Split
| @@ -540,18 +540,17 @@ namespace GSF.ServiceProcess · 539 unmodified lines | |||
| 540 | /// </summary> | 540 | /// </summary> |
| 541 | public void Connect() | 541 | public void Connect() |
| 542 | { | 542 | { |
| 543 | if ((object)m_remotingClient == null) | 543 | ClientBase remotingClient = m_remotingClient; |
| 544 | |||
| 545 | if ((object)remotingClient == null) | ||
| 544 | throw new InvalidOperationException("RemotingClient property of ClientHelper component is not set"); | 546 | throw new InvalidOperationException("RemotingClient property of ClientHelper component is not set"); |
| 545 | 547 | ||
| 546 | m_authenticationComplete = false; | 548 | m_authenticationComplete = false; |
| 547 | 549 | ||
| 548 | // Wait for connection. | 550 | // Wait for connection. |
| 549 | m_remotingClient.Connect(); | 551 | remotingClient.Connect(); |
| 550 | |||
| 551 | const int MaxWaitPeriods = 50; // Will wait a maximum of 5 seconds before assuming failure | ||
| 552 | int attempts = 0; | ||
| 553 | 552 | ||
| 554 | while (!m_authenticationComplete && m_remotingClient.Enabled && attempts++ < MaxWaitPeriods) | 553 | while (remotingClient.Enabled && !m_authenticationComplete) |
| 555 | { | 554 | { |
| 556 | // Wait for authentication. | 555 | // Wait for authentication. |
| 557 | Thread.Sleep(100); | 556 | Thread.Sleep(100); |
| @@ -561,14 +560,10 @@ namespace GSF.ServiceProcess · 3 unmodified lines | |||
| 561 | return; | 560 | return; |
| 562 | } | 561 | } |
| 563 | 562 | ||
| 564 | // It is possible that local domain account will not be accepted and/or recognized by remote | 563 | if (!m_authenticationComplete) |
| 565 | // server when attempting to use integrated security - in these cases the sent client info | 564 | UpdateStatus(UpdateType.Alarm, "Connection was terminated before completing authentication.\r\n\r\n"); |
| 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(); | ||
| 570 | 565 | ||
| 571 | if (m_remotingClient.Enabled) | 566 | if (remotingClient.Enabled) |
| 572 | m_attemptReconnection = true; | 567 | m_attemptReconnection = true; |
| 573 | } | 568 | } |
| 574 | 569 | ||
| @@ -777,7 +772,6 @@ namespace GSF.ServiceProcess · 202 unmodified lines | |||
| 777 | status.Append(m_remotingClient.Status); | 772 | status.Append(m_remotingClient.Status); |
| 778 | status.AppendLine(); | 773 | status.AppendLine(); |
| 779 | UpdateStatus(UpdateType.Information, "{0}", status.ToString()); | 774 | UpdateStatus(UpdateType.Information, "{0}", status.ToString()); |
| 780 | SendRequest(StatusMessageFilter); | ||
| 781 | } | 775 | } |
| 782 | 776 | ||
| 783 | private void RemotingClient_ConnectionException(object sender, EventArgs<Exception> e) | 777 | private void RemotingClient_ConnectionException(object sender, EventArgs<Exception> e) |
| @@ -848,6 +842,7 @@ namespace GSF.ServiceProcess · 64 unmodified lines | |||
| 848 | UpdateStatus(UpdateType.Alarm, "{0}", response.Message); | 842 | UpdateStatus(UpdateType.Alarm, "{0}", response.Message); |
| 849 | break; | 843 | break; |
| 850 | case "AUTHENTICATIONSUCCESS": | 844 | case "AUTHENTICATIONSUCCESS": |
| 845 | SendRequest(StatusMessageFilter); | ||
| 851 | OnAuthenticationSuccess(); | 846 | OnAuthenticationSuccess(); |
| 852 | break; | 847 | break; |
| 853 | case "AUTHENTICATIONFAILURE": | 848 | case "AUTHENTICATIONFAILURE": |