Skip to content

Commit d026fb4

Browse files
committed
revert & fixes
1 parent c18c928 commit d026fb4

File tree

3 files changed

+9
-14
lines changed

3 files changed

+9
-14
lines changed

SmartImage.Lib/Engines/Search/IqdbEngine.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ protected override SearchResult Process(object obj, SearchResult sr)
140140
// Don't select other results
141141
var query = (ImageQuery) obj;
142142
var doc = GetDocument(query);
143-
doc.Wait();
143+
144144
var pages = doc.Result.Body.SelectSingleNode("//div[@id='pages']");
145145
var tables = ((IHtmlElement) pages).SelectNodes("div/table");
146146

SmartImage.Lib/SearchClient.cs

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public SearchClient(SearchConfig config)
4646
DirectResultsWaitHandle = new AutoResetEvent(false);
4747

4848
Reload();
49-
49+
5050
}
5151

5252
/// <summary>
@@ -253,7 +253,7 @@ public async Task RunContinueAsync(CancellationToken? c = null)
253253

254254
}
255255

256-
if (!DirectResultsWaitHandle.SafeWaitHandle.IsInvalid || !DirectResultsWaitHandle.SafeWaitHandle.IsClosed) {
256+
if (!DirectResultsWaitHandle.SafeWaitHandle.IsInvalid||!DirectResultsWaitHandle.SafeWaitHandle.IsClosed) {
257257
((AutoResetEvent) DirectResultsWaitHandle).Set();
258258
}
259259
}
@@ -280,17 +280,13 @@ private void GetResultContinueCallback(Task<SearchResult> task, object state)
280280
DirectResults.AddRange(result);
281281

282282
value.Scanned = true;
283-
var autoResetEvent = ((AutoResetEvent) DirectResultsWaitHandle);
284-
285-
286-
if (DirectResults.Count > 0 /*||
287-
!DirectResultsWaitHandle.SafeWaitHandle.IsClosed*/ /*|| ContinueTasks.Count==1*/) {
283+
var autoResetEvent = ((AutoResetEvent)DirectResultsWaitHandle);
284+
288285

289-
if (!DirectResultsWaitHandle.SafeWaitHandle.IsClosed) {
290-
Debug.WriteLine("wait handle set");
291-
autoResetEvent.Set();
292-
293-
}
286+
if (DirectResults.Count > 0 &&
287+
!DirectResultsWaitHandle.SafeWaitHandle.IsClosed /*|| ContinueTasks.Count==1*/) {
288+
Debug.WriteLine("wait handle set");
289+
autoResetEvent.Set();
294290
}
295291

296292
DirectResultCompleted?.Invoke(null, EventArgs.Empty);

SmartImage/Program.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,6 @@ private static async Task Main(string[] args)
240240
//ignored
241241
}
242242

243-
244243
/*Client.Dispose();
245244
Client.Reset();
246245
*/

0 commit comments

Comments
 (0)