History

GSF.ServiceProcess: Fixed issue where normal messages were flowing during a telnet sessions.

J. Ritchie Carroll committed 9 years ago

Commit fded2741 parent 2fc3cac12 files · +30 −102Browse files

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

Unified · Split

6 files
  1. Source/Libraries/GSF.ServiceProcess/ClientHelper.cs +2 −8
  2. Source/Libraries/GSF.ServiceProcess/ClientInfo.cs +6 −36
  3. Source/Libraries/GSF.ServiceProcess/ClientRequest.cs +2 −8
  4. Source/Libraries/GSF.ServiceProcess/ServiceHelper.cs +4 −10
  5. Source/Libraries/GSF.ServiceProcess/ServiceProcess.cs +3 −21
  6. Source/Libraries/GSF.ServiceProcess/ServiceResponse.cs +1 −7
Source/Libraries/GSF.ServiceProcess/ClientHelper.cs+2−8
@@ -394,13 +394,7 @@ namespace GSF.ServiceProcess · 393 unmodified lines
394394 [Browsable(false),
395395 EditorBrowsable(EditorBrowsableState.Never),
396396 DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
397− public bool IsDisposed
398− {
399− get
400− {
401− return m_disposed;
402− }
403− }
397+ public bool IsDisposed => m_disposed;
404398
405399 #endregion
406400
@@ -596,7 +590,7 @@ namespace GSF.ServiceProcess · 189 unmodified lines
596590 else
597591 {
598592 // File does not exist.
599− throw new FileNotFoundException(string.Format("File '{0}' does not exist", source));
593+ throw new FileNotFoundException($"File '{source}' does not exist");
600594 }
601595 }
602596
Source/Libraries/GSF.ServiceProcess/ClientInfo.cs+6−36
@@ -107,7 +107,7 @@ namespace GSF.ServiceProcess · 106 unmodified lines
107107 if ((object)parent == null || string.IsNullOrEmpty(parent.Username) || string.IsNullOrEmpty(parent.Password))
108108 m_clientUserCredentials = string.Empty;
109109 else
110− m_clientUserCredentials = string.Format("{0}:{1}", parent.Username, parent.Password);
110+ m_clientUserCredentials = $"{parent.Username}:{parent.Password}";
111111
112112 // Initialize client application name.
113113 if (m_clientType == ApplicationType.Web)
@@ -181,57 +181,27 @@ namespace GSF.ServiceProcess · 67 unmodified lines
181181 /// <summary>
182182 /// Gets the <see cref="ApplicationType"/> of the remote client application.
183183 /// </summary>
184− public ApplicationType ClientType
185− {
186− get
187− {
188− return m_clientType;
189− }
190− }
184+ public ApplicationType ClientType => m_clientType;
191185
192186 /// <summary>
193187 /// Gets the friendly name of the remote client application.
194188 /// </summary>
195− public string ClientName
196− {
197− get
198− {
199− return m_clientName;
200− }
201− }
189+ public string ClientName => m_clientName;
202190
203191 /// <summary>
204192 /// Gets the <see cref="IPrincipal"/> of the remote client application's user.
205193 /// </summary>
206− public IPrincipal ClientUser
207− {
208− get
209− {
210− return m_clientUser;
211− }
212− }
194+ public IPrincipal ClientUser => m_clientUser;
213195
214196 /// <summary>
215197 /// Gets the credentials in 'username:password' format for authenticating the remote client application's user if a valid <see cref="ClientUser"/> is not available.
216198 /// </summary>
217− public string ClientUserCredentials
218− {
219− get
220− {
221− return m_clientUserCredentials;
222− }
223− }
199+ public string ClientUserCredentials => m_clientUserCredentials;
224200
225201 /// <summary>
226202 /// Gets the name of the machine running the remote client application.
227203 /// </summary>
228− public string MachineName
229− {
230− get
231− {
232− return m_machineName;
233− }
234− }
204+ public string MachineName => m_machineName;
235205
236206 /// <summary>
237207 /// Gets or sets the <see cref="DateTime"/> when the remote client application connected to the <see cref="ServiceHelper"/>.
Source/Libraries/GSF.ServiceProcess/ClientRequest.cs+2−8
@@ -153,13 +153,7 @@ namespace GSF.ServiceProcess · 152 unmodified lines
153153 /// <summary>
154154 /// Gets a list of attachments for the <see cref="ClientRequest"/>.
155155 /// </summary>
156− public List<object> Attachments
157− {
158− get
159− {
160− return m_attachments;
161− }
162− }
156+ public List<object> Attachments => m_attachments;
163157
164158 #endregion
165159
@@ -171,7 +165,7 @@ namespace GSF.ServiceProcess · 5 unmodified lines
171165 /// <returns>A <see cref="String"/> that represents the <see cref="ClientRequest"/>.</returns>
172166 public override string ToString()
173167 {
174− return string.Format("{0} {1}", m_command, m_arguments).Trim();
168+ return $"{m_command} {m_arguments}".Trim();
175169 }
176170
177171 /// <summary>
Source/Libraries/GSF.ServiceProcess/ServiceHelper.cs+4−10
@@ -2448,9 +2448,9 @@ namespace GSF.ServiceProcess · 2447 unmodified lines
24482448 SendResponse(clientID, new ServiceResponse("AuthenticationFailure"));
24492449 }
24502450
2451− private void SendUpdateClientStatusResponse(Guid clientID, UpdateType type, string responseMessage)
2451+ private void SendUpdateClientStatusResponse(Guid clientID, UpdateType type, string responseMessage, bool telnetMessage = false)
24522452 {
2453− if (string.IsNullOrEmpty(responseMessage))
2453+ if (string.IsNullOrEmpty(responseMessage) || (clientID == m_remoteCommandClientID && !telnetMessage))
24542454 return;
24552455
24562456 ServiceResponse response = new ServiceResponse();
@@ -2680,15 +2680,9 @@ namespace GSF.ServiceProcess · 223 unmodified lines
26802680 }
26812681 }
26822682
2683− private void RemoteCommandProcess_ErrorDataReceived(object sender, DataReceivedEventArgs e)
2684− {
2685− UpdateStatus(m_remoteCommandClientID, UpdateType.Alarm, e.Data + "\r\n");
2686− }
2683+ private void RemoteCommandProcess_ErrorDataReceived(object sender, DataReceivedEventArgs e) => SendUpdateClientStatusResponse(m_remoteCommandClientID, UpdateType.Alarm, $"{e.Data}\r\n", true);
26872684
2688− private void RemoteCommandProcess_OutputDataReceived(object sender, DataReceivedEventArgs e)
2689− {
2690− UpdateStatus(m_remoteCommandClientID, UpdateType.Information, e.Data + "\r\n");
2691− }
2685+ private void RemoteCommandProcess_OutputDataReceived(object sender, DataReceivedEventArgs e) => SendUpdateClientStatusResponse(m_remoteCommandClientID, UpdateType.Information, $"{e.Data}\r\n", true);
26922686
26932687 #region [ Client Request Handlers ]
26942688
Source/Libraries/GSF.ServiceProcess/ServiceProcess.cs+3−21
@@ -198,35 +198,17 @@ namespace GSF.ServiceProcess · 197 unmodified lines
198198 /// <summary>
199199 /// Gets the <see cref="DateTime"/> when execution of <see cref="ServiceProcess"/> last started.
200200 /// </summary>
201− public DateTime ExecutionStartTime
202− {
203− get
204− {
205− return m_executionStartTime;
206− }
207− }
201+ public DateTime ExecutionStartTime => m_executionStartTime;
208202
209203 /// <summary>
210204 /// Gets the <see cref="DateTime"/> when execution of <see cref="ServiceProcess"/> last completed.
211205 /// </summary>
212− public DateTime ExecutionStopTime
213− {
214− get
215− {
216− return m_executionStopTime;
217− }
218− }
206+ public DateTime ExecutionStopTime => m_executionStopTime;
219207
220208 /// <summary>
221209 /// Gets the <see cref="Time"/> taken by the <see cref="ServiceProcess"/> during the last execution.
222210 /// </summary>
223− public Time LastExecutionTime
224− {
225− get
226− {
227− return Ticks.ToSeconds(m_executionStopTime.Ticks - m_executionStartTime.Ticks);
228− }
229− }
211+ public Time LastExecutionTime => Ticks.ToSeconds(m_executionStopTime.Ticks - m_executionStartTime.Ticks);
230212
231213 /// <summary>
232214 /// Gets the descriptive status of the <see cref="ServiceProcess"/>.
Source/Libraries/GSF.ServiceProcess/ServiceResponse.cs+1−7
@@ -146,13 +146,7 @@ namespace GSF.ServiceProcess · 145 unmodified lines
146146 /// <summary>
147147 /// Gets a list of serializable attachments of the <see cref="ServiceResponse"/>.
148148 /// </summary>
149− public List<object> Attachments
150− {
151− get
152− {
153− return m_attachments;
154− }
155− }
149+ public List<object> Attachments => m_attachments;
156150
157151 #endregion
158152

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