@@ -188,29 +188,26 @@ Public Class Nut_Socket
188188 ''' </summary>
189189 ''' <param name="Query_Msg">The query to be sent to the server, within specifications of the NUT protocol.</param>
190190 ''' <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>
192193 ''' <exception cref="NutException">Thrown when the NUT server returns an error or unexpected response.</exception>
193194 Function Query_Data(Query_Msg As String ) As Transaction
194195 Dim Response As NUTResponse
195196 Dim DataResult As String
196197 Dim finalTransaction As Transaction
197198
198199 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." )
201201 End If
202202
203- streamInUse = True
204-
205203 If ConnectionStatus Then
206- ' LogFile.LogTracing("Query: " & Query_Msg, LogLvl.LOG_DEBUG, Me)
204+ streamInUse = True
205+
207206 WriterStream.WriteLine(Query_Msg & vbCr)
208207 WriterStream.Flush()
209-
210208 DataResult = Trim(ReaderStream.ReadLine())
211- ' LogFile.LogTracing(vbTab & "Response: " & DataResult, LogLvl.LOG_DEBUG, Me)
209+
212210 streamInUse = False
213- ' LogFile.LogTracing("Done processing response for query " & Query_Msg, LogLvl.LOG_DEBUG, Me)
214211
215212 Response = EnumResponse(DataResult)
216213 finalTransaction = New Transaction(Query_Msg, DataResult, Response)
0 commit comments