@@ -188,29 +188,26 @@ Public Class Nut_Socket
188
188
''' </summary>
189
189
''' <param name="Query_Msg">The query to be sent to the server, within specifications of the NUT protocol.</param>
190
190
''' <returns>The full <see cref="Transaction"/> of this function call.</returns>
191
- ''' <exception cref="InvalidOperationException">Thrown when calling this function while disconnected.</exception>"
191
+ ''' <exception cref="InvalidOperationException">Thrown when calling this function while disconnected, or another
192
+ ''' call is in progress.</exception>
192
193
''' <exception cref="NutException">Thrown when the NUT server returns an error or unexpected response.</exception>
193
194
Function Query_Data(Query_Msg As String ) As Transaction
194
195
Dim Response As NUTResponse
195
196
Dim DataResult As String
196
197
Dim finalTransaction As Transaction
197
198
198
199
If streamInUse Then
199
- LogFile.LogTracing( "Attempted to query " & Query_Msg & " while using the stream." , LogLvl.LOG_ERROR, Me )
200
- Return Nothing
200
+ Throw New InvalidOperationException( "Attempted to query " & Query_Msg & " while stream is in use." )
201
201
End If
202
202
203
- streamInUse = True
204
-
205
203
If ConnectionStatus Then
206
- ' LogFile.LogTracing("Query: " & Query_Msg, LogLvl.LOG_DEBUG, Me)
204
+ streamInUse = True
205
+
207
206
WriterStream.WriteLine(Query_Msg & vbCr)
208
207
WriterStream.Flush()
209
-
210
208
DataResult = Trim(ReaderStream.ReadLine())
211
- ' LogFile.LogTracing(vbTab & "Response: " & DataResult, LogLvl.LOG_DEBUG, Me)
209
+
212
210
streamInUse = False
213
- ' LogFile.LogTracing("Done processing response for query " & Query_Msg, LogLvl.LOG_DEBUG, Me)
214
211
215
212
Response = EnumResponse(DataResult)
216
213
finalTransaction = New Transaction(Query_Msg, DataResult, Response)
0 commit comments