Levente Uzonyi uploaded a new version of Network to project The Trunk:
http://source.squeak.org/trunk/Network-ul.187.mcz ==================== Summary ==================== Name: Network-ul.187 Author: ul Time: 27 February 2017, 2:23:35.659844 am UUID: 6bb5fee1-2a6c-45d5-98b2-5dae6e7f122c Ancestors: Network-eem.186 - omit ifAbsent from #index* sends when the default value, 0 would used =============== Diff against Network-eem.186 =============== Item was changed: ----- Method: MailAddressTokenizer>>nextComment (in category 'tokenizing') ----- nextComment | start nestLevel paren | start := pos. pos := pos + 1. nestLevel := 1. [ nestLevel > 0 ] whileTrue: [ + pos := text indexOfAnyOf: self class parenthesesSet startingAt: pos. - pos := text indexOfAnyOf: self class parenthesesSet startingAt: pos ifAbsent: [ 0 ]. pos = 0 ifTrue: [ self error: 'unterminated comment. ie, more (''s than )''s' ]. paren := self nextChar. paren = $( ifTrue: [ nestLevel := nestLevel + 1 ] ifFalse: [ nestLevel := nestLevel - 1 ]]. ^ MailAddressToken type: #Comment text: (text copyFrom: start to: pos - 1)! Item was changed: ----- Method: MailAddressTokenizer>>nextDomainLiteral (in category 'tokenizing') ----- nextDomainLiteral | start end | start := pos. + end := text indexOf: $] startingAt: start. - end := text indexOf: $] startingAt: start ifAbsent: [ 0 ]. end = 0 ifTrue: [ "not specified" self error: 'saw [ without a matching ]' ]. pos := end+1. ^MailAddressToken type: #DomainLiteral text: (text copyFrom: start to: end)! Item was changed: ----- Method: SocketStream>>upTo:limit: (in category 'stream in') ----- upTo: aCharacterOrByte limit: nBytes "Return data up to, but not including given character or byte. If the character is not in the stream, or not found within nBytes answer the available contents of the stream" | target index result searchedSoFar | "Deal with ascii vs. binary" self isBinary ifTrue:[target := aCharacterOrByte asInteger] ifFalse:[target := aCharacterOrByte asCharacter]. "Look in the current inBuffer first" + index := inBuffer indexOf: target startingAt: lastRead + 1. - index := inBuffer indexOf: target startingAt: lastRead + 1 ifAbsent:[0]. (index > 0 and: [(index + 1) <= inNextToWrite]) ifTrue: ["found it" result := self nextInBuffer: index - lastRead - 1. self skip: 1. ^ result ]. [searchedSoFar := self inBufferSize. "Receive more data" self receiveData. "We only get recentlyRead = 0 in the case of a non-signaling socket close." recentlyRead > 0] whileTrue:[ "Data begins at lastRead + 1, we add searchedSoFar as offset." + index := inBuffer indexOf: target startingAt: (lastRead + searchedSoFar + 1). - index := inBuffer indexOf: target - startingAt: (lastRead + searchedSoFar + 1) - ifAbsent:[0]. (index > 0 and: [(index + 1) <= inNextToWrite]) ifTrue: ["found it" result := self nextInBuffer: index - lastRead - 1. self skip: 1. ^ result ]. "Check if we've exceeded the max. amount" (nBytes notNil and:[inNextToWrite - lastRead > nBytes]) ifTrue:[^self nextAllInBuffer]. ]. "not found and (non-signaling) connection was closed" ^self nextAllInBuffer! |
Free forum by Nabble | Edit this page |