tim Rowledge uploaded a new version of UpdateStream to project The Trunk:
http://source.squeak.org/trunk/UpdateStream-tpr.11.mcz ==================== Summary ==================== Name: UpdateStream-tpr.11 Author: tpr Time: 18 February 2019, 7:25:41.894118 pm UUID: 00e59d34-daaf-40f8-b4ee-306f21613bfc Ancestors: UpdateStream-ul.10 Part of deprecating HTTPClient for 6.0 Stop using it =============== Diff against UpdateStream-ul.10 =============== Item was removed: - ----- Method: AutoStart class>>checkForUpdates (in category '*UpdateStream') ----- - checkForUpdates - | availableUpdate updateServer | - HTTPClient isRunningInBrowser ifFalse: [ ^ self processUpdates ]. - availableUpdate := (Smalltalk namedArguments - at: 'UPDATE' - ifAbsent: [ '' ]) asInteger. - availableUpdate ifNil: [ ^ false ]. - updateServer := Smalltalk namedArguments - at: 'UPDATESERVER' - ifAbsent: - [ Smalltalk namedArguments - at: 'UPDATE_SERVER' - ifAbsent: [ 'Squeakland' ] ]. - UpdateStreamDownloader default setUpdateServer: updateServer. - ^ SystemVersion checkAndApplyUpdates: availableUpdate! Item was changed: ----- Method: UpdateStreamDownloader class>>newUpdatesOn:special:throughNumber: (in category 'fetching updates') ----- newUpdatesOn: serverList special: indexPrefix throughNumber: aNumber "Return a list of fully formed URLs of update files we do not yet have. Go to the listed servers and look at the file 'updates.list' for the names of the last N update files. We look backwards for the first one we have, and make the list from there. tk 9/10/97 No updates numbered higher than aNumber (if it is not nil) are returned " | existing out maxNumber | maxNumber := aNumber ifNil: [99999]. out := OrderedCollection new. existing := SystemVersion current updates. serverList do: [:server | | raw doc list char | + doc := HTTPSocket httpGet: 'http://' , server,indexPrefix,'updates.list'. - doc := HTTPClient httpGet: 'http://' , server,indexPrefix,'updates.list'. "test here for server being up" doc class == RWBinaryOrTextStream ifTrue: [raw := doc reset; contents. "one file name per line" list := self extractThisVersion: raw. list reverseDo: [:fileName | | ff itsNumber | ff := (fileName findTokens: '/') last. "allow subdirectories" itsNumber := ff initialIntegerOrNil. (existing includes: itsNumber) ifFalse: [ (itsNumber == nil or: [itsNumber <= maxNumber]) ifTrue: [out addFirst: 'http://' , server, fileName]] ifTrue: [^ out]]. ((out size > 0) or: [char := doc reset; skipSeparators; next. (char == $*) | (char == $#)]) ifTrue: [^ out "we have our list"]]. "else got error msg instead of file" "Server was down, try next one"]. self inform: 'All code update servers seem to be unavailable'. ^ out! 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 := HTTPSocket httpGet: 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: [ 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! |
> On 19.02.2019, at 04:25, [hidden email] wrote:
> > tim Rowledge uploaded a new version of UpdateStream to project The Trunk: > http://source.squeak.org/trunk/UpdateStream-tpr.11.mcz > > ==================== Summary ==================== > > Name: UpdateStream-tpr.11 > Author: tpr > Time: 18 February 2019, 7:25:41.894118 pm > UUID: 00e59d34-daaf-40f8-b4ee-306f21613bfc > Ancestors: UpdateStream-ul.10 > > Part of deprecating HTTPClient for 6.0 > Stop using it > > =============== Diff against UpdateStream-ul.10 =============== > > Item was removed: > - ----- Method: AutoStart class>>checkForUpdates (in category '*UpdateStream') ----- > - checkForUpdates > - | availableUpdate updateServer | > - HTTPClient isRunningInBrowser ifFalse: [ ^ self processUpdates ]. > - availableUpdate := (Smalltalk namedArguments > - at: 'UPDATE' > - ifAbsent: [ '' ]) asInteger. > - availableUpdate ifNil: [ ^ false ]. > - updateServer := Smalltalk namedArguments > - at: 'UPDATESERVER' > - ifAbsent: > - [ Smalltalk namedArguments > - at: 'UPDATE_SERVER' > - ifAbsent: [ 'Squeakland' ] ]. > - UpdateStreamDownloader default setUpdateServer: updateServer. > - ^ SystemVersion checkAndApplyUpdates: availableUpdate! > > Item was changed: > ----- Method: UpdateStreamDownloader class>>newUpdatesOn:special:throughNumber: (in category 'fetching updates') ----- > newUpdatesOn: serverList special: indexPrefix throughNumber: aNumber > "Return a list of fully formed URLs of update files we do not yet have. Go to the listed servers and look at the file 'updates.list' for the names of the last N update files. We look backwards for the first one we have, and make the list from there. tk 9/10/97 > No updates numbered higher than aNumber (if it is not nil) are returned " > > | existing out maxNumber | > maxNumber := aNumber ifNil: [99999]. > out := OrderedCollection new. > existing := SystemVersion current updates. > serverList do: [:server | | raw doc list char | > + doc := HTTPSocket httpGet: 'http://' , server,indexPrefix,'updates.list'. > - doc := HTTPClient httpGet: 'http://' , server,indexPrefix,'updates.list'. Why not WebClient directly? -t > > "test here for server being up" > doc class == RWBinaryOrTextStream ifTrue: > [raw := doc reset; contents. "one file name per line" > list := self extractThisVersion: raw. > list reverseDo: [:fileName | | ff itsNumber | > ff := (fileName findTokens: '/') last. "allow subdirectories" > itsNumber := ff initialIntegerOrNil. > (existing includes: itsNumber) > ifFalse: > [ > (itsNumber == nil or: [itsNumber <= maxNumber]) > ifTrue: > [out addFirst: 'http://' , server, fileName]] > ifTrue: [^ out]]. > ((out size > 0) or: [char := doc reset; skipSeparators; next. > (char == $*) | (char == $#)]) ifTrue: > [^ out "we have our list"]]. "else got error msg instead of file" > "Server was down, try next one"]. > self inform: 'All code update servers seem to be unavailable'. > ^ out! > > 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 := HTTPSocket httpGet: 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: [ > 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! > > |
> On 2019-02-18, at 9:54 PM, Tobias Pape <[hidden email]> wrote: >> >> Item was changed: >> ----- Method: UpdateStreamDownloader class>>newUpdatesOn:special:throughNumber: (in category 'fetching updates') ----- >> newUpdatesOn: serverList special: indexPrefix throughNumber: aNumber >> "Return a list of fully formed URLs of update files we do not yet have. Go to the listed servers and look at the file 'updates.list' for the names of the last N update files. We look backwards for the first one we have, and make the list from there. tk 9/10/97 >> No updates numbered higher than aNumber (if it is not nil) are returned " >> >> | existing out maxNumber | >> maxNumber := aNumber ifNil: [99999]. >> out := OrderedCollection new. >> existing := SystemVersion current updates. >> serverList do: [:server | | raw doc list char | >> + doc := HTTPSocket httpGet: 'http://' , server,indexPrefix,'updates.list'. >> - doc := HTTPClient httpGet: 'http://' , server,indexPrefix,'updates.list'. > > Why not WebClient directly? Baby steps. And time; feel free to bang on it a bit more. tim -- tim Rowledge; [hidden email]; http://www.rowledge.org/tim Strange OpCodes: WAF: Warn After the Fact |
> On 19.02.2019, at 07:04, tim Rowledge <[hidden email]> wrote: > > > >> On 2019-02-18, at 9:54 PM, Tobias Pape <[hidden email]> wrote: >>> >>> Item was changed: >>> ----- Method: UpdateStreamDownloader class>>newUpdatesOn:special:throughNumber: (in category 'fetching updates') ----- >>> newUpdatesOn: serverList special: indexPrefix throughNumber: aNumber >>> "Return a list of fully formed URLs of update files we do not yet have. Go to the listed servers and look at the file 'updates.list' for the names of the last N update files. We look backwards for the first one we have, and make the list from there. tk 9/10/97 >>> No updates numbered higher than aNumber (if it is not nil) are returned " >>> >>> | existing out maxNumber | >>> maxNumber := aNumber ifNil: [99999]. >>> out := OrderedCollection new. >>> existing := SystemVersion current updates. >>> serverList do: [:server | | raw doc list char | >>> + doc := HTTPSocket httpGet: 'http://' , server,indexPrefix,'updates.list'. >>> - doc := HTTPClient httpGet: 'http://' , server,indexPrefix,'updates.list'. >> >> Why not WebClient directly? > > Baby steps. And time; feel free to bang on it a bit more. Point taken. Go ahead. :) Best regards -Tobias |
Free forum by Nabble | Edit this page |