Showing the changes to Source/Libraries/GSF.ServiceProcess/ClientHelper.cs (1 of 6 files). Show all
Unified · Split
| @@ -540,18 +540,17 @@ namespace GSF.ServiceProcess · 539 unmodified lines | ||
| 540 | 540 | /// </summary> |
| 541 | 541 | public void Connect() |
| 542 | 542 | { |
| 543 | − if ((object)m_remotingClient == null) | |
| 543 | + ClientBase remotingClient = m_remotingClient; | |
| 544 | + | |
| 545 | + if ((object)remotingClient == null) | |
| 544 | 546 | throw new InvalidOperationException("RemotingClient property of ClientHelper component is not set"); |
| 545 | 547 | |
| 546 | 548 | m_authenticationComplete = false; |
| 547 | 549 | |
| 548 | 550 | // 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(); | |
| 553 | 552 | |
| 554 | − while (!m_authenticationComplete && m_remotingClient.Enabled && attempts++ < MaxWaitPeriods) | |
| 553 | + while (remotingClient.Enabled && !m_authenticationComplete) | |
| 555 | 554 | { |
| 556 | 555 | // Wait for authentication. |
| 557 | 556 | Thread.Sleep(100); |
| @@ -561,14 +560,10 @@ namespace GSF.ServiceProcess · 3 unmodified lines | ||
| 561 | 560 | return; |
| 562 | 561 | } |
| 563 | 562 | |
| 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"); | |
| 570 | 565 | |
| 571 | − if (m_remotingClient.Enabled) | |
| 566 | + if (remotingClient.Enabled) | |
| 572 | 567 | m_attemptReconnection = true; |
| 573 | 568 | } |
| 574 | 569 | |
| @@ -777,7 +772,6 @@ namespace GSF.ServiceProcess · 202 unmodified lines | ||
| 777 | 772 | status.Append(m_remotingClient.Status); |
| 778 | 773 | status.AppendLine(); |
| 779 | 774 | UpdateStatus(UpdateType.Information, "{0}", status.ToString()); |
| 780 | − SendRequest(StatusMessageFilter); | |
| 781 | 775 | } |
| 782 | 776 | |
| 783 | 777 | private void RemotingClient_ConnectionException(object sender, EventArgs<Exception> e) |
| @@ -848,6 +842,7 @@ namespace GSF.ServiceProcess · 64 unmodified lines | ||
| 848 | 842 | UpdateStatus(UpdateType.Alarm, "{0}", response.Message); |
| 849 | 843 | break; |
| 850 | 844 | case "AUTHENTICATIONSUCCESS": |
| 845 | + SendRequest(StatusMessageFilter); | |
| 851 | 846 | OnAuthenticationSuccess(); |
| 852 | 847 | break; |
| 853 | 848 | case "AUTHENTICATIONFAILURE": |