Levente Uzonyi uploaded a new version of UpdateStream to project The Trunk:
http://source.squeak.org/trunk/UpdateStream-ul.5.mcz==================== Summary ====================
Name: UpdateStream-ul.5
Author: ul
Time: 14 August 2015, 7:51:22.944 pm
UUID: e4d793e4-bd54-4ca3-a232-998259a83102
Ancestors: UpdateStream-nice.4
#includesSubString: -> #includesSubstring:
=============== Diff against UpdateStream-nice.4 ===============
Item was changed:
----- Method: UpdateStreamDownloader class>>retrieveUrls:ontoQueue:withWaitSema: (in category 'fetching updates') -----
retrieveUrls: urls ontoQueue: queue withWaitSema: waitSema
"download the given list of URLs. The queue will be loaded alternately
with url's and with the retrieved contents. If a download fails, the
contents will be #failed. If all goes well, a special pair with an empty
URL and the contents #finished will be put on the queue. waitSema is
waited on every time before a new document is downloaded; this keeps
the downloader from getting too far ahead of the main process"
"kill the existing downloader if there is one"
| updateCounter |
UpdateDownloader
ifNotNil: [UpdateDownloader terminate].
updateCounter := 0.
"fork a new downloading process"
UpdateDownloader := [
'Downloading updates' displayProgressFrom: 0 to: urls size during: [:bar |
urls
do: [:url | | front canPeek doc |
waitSema wait.
queue nextPut: url.
doc := HTTPClient httpGet: url.
doc isString
ifTrue: [queue nextPut: #failed.
UpdateDownloader := nil.
Processor activeProcess terminate]
ifFalse: [canPeek := 120 min: doc size.
front := doc next: canPeek. doc skip: -1 * canPeek.
(front beginsWith: '<!!DOCTYPE') ifTrue: [
+ (front includesSubstring: 'Not Found') ifTrue: [
- (front includesSubString: 'Not Found') ifTrue: [
queue nextPut: #failed.
UpdateDownloader := nil.
Processor activeProcess terminate]]].
UpdateDownloader ifNotNil: [queue nextPut: doc. updateCounter := updateCounter + 1. bar value: updateCounter]]].
queue nextPut: ''.
queue nextPut: #finished.
UpdateDownloader := nil] newProcess.
UpdateDownloader priority: Processor userInterruptPriority.
"start the process running"
UpdateDownloader resume!