Skip to content

Commit

Permalink
Issue GsDevKit#60: today I had an incident where 500ms timeout was cl…
Browse files Browse the repository at this point in the history
…early not long enough ... going with 20 seconds for now ... I see where a different strategy is called for...
  • Loading branch information
dalehenrich committed Mar 23, 2015
1 parent 41687b1 commit d08b2db
Show file tree
Hide file tree
Showing 54 changed files with 187 additions and 178 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"associations" : "DataCurator 04/23/2007 14:43",
"at:ifPresent:ifAbsent:" : "RamonLeon 10/25/2010 20:43",
"hasBindingThatBeginsWith:" : "dkh 12/02/2007 16:01",
"isDictionary" : "dkh 11/11/2009 13:55",
"isDictionary" : "DaleHenrichs 01/28/2010 16:19",
"keysAndValuesRemove:" : "dkh 07/23/2007 11:32",
"keysSortedSafely" : "DataCurator 04/23/2007 14:43",
"removeAll" : "DaleHenrichs 08/18/2010 14:33" } }
"removeAll" : "DaleHenrichs 10/25/2010 16:01" } }
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"class" : {
},
"instance" : {
"isArray" : "dkh 11/11/2009 13:54",
"isArray" : "DaleHenrichs 01/28/2010 16:19",
"printElementsOn:" : "DataCurator 04/23/2007 14:43",
"sendTo:" : "DaleHenrichs 08/18/2010 12:59",
"sentTo:" : "DaleHenrichs 08/18/2010 13:02",
"sendTo:" : "DaleHenrichs 10/25/2010 16:01",
"sentTo:" : "DaleHenrichs 10/25/2010 16:01",
"squeakPrintString" : "DataCurator 04/23/2007 14:43" } }
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
"instance" : {
"sortedCounts" : "DataCurator 04/23/2007 14:43",
"sortedElements" : "",
"valuesAndCounts" : "DaleHenrichs 06/04/2010 10:07" } }
"valuesAndCounts" : "DaleHenrichs 10/25/2010 14:42" } }
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
"class" : {
"infinity" : "dkh 03/07/2008 17:06",
"nan" : "dkh 02/12/2009 16:42",
"negativeZero" : "DaleHenrichs 08/18/2010 14:33",
"negativeZero" : "DaleHenrichs 10/25/2010 16:01",
"readFrom:" : "dkh 10/22/2008 12:11" },
"instance" : {
"absPrintOn:base:" : "DaleHenrichs 10/25/2010 14:42",
"asSqueakPrintString" : "DaleHenrichs 06/04/2010 15:53",
"asSqueakPrintString" : "DaleHenrichs 10/25/2010 14:42",
"exponent" : "DaleHenrichs 10/25/2010 14:42",
"isFloat" : "dkh 10/20/2008 12:10",
"isInfinite" : "DaleHenrichs 10/25/2010 16:01",
"printOn:base:" : "DaleHenrichs 10/25/2010 14:42",
"reciprocalLogBase2" : "DaleHenrichs 06/04/2010 14:59",
"significand" : "DaleHenrichs 06/04/2010 15:00",
"reciprocalLogBase2" : "DaleHenrichs 10/25/2010 14:42",
"significand" : "DaleHenrichs 10/25/2010 14:42",
"timesTwoPower:" : "DaleHenrichs 10/25/2010 14:42" } }
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"isBlock" : "dkh 01/27/2008 08:47",
"numArgs" : "",
"timeToRun" : "dkh 06/14/2007 15:40",
"valueSupplyingAnswers:" : "dkh 10/28/2009 11:06",
"valueSupplyingAnswers:" : "DaleHenrichs 01/28/2010 16:19",
"valueWithEnoughArguments:" : "dkh 08/04/2009 14:37" } }
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"adaptToPoint:andSend:" : "dkh 02/12/2009 16:51",
"asDate" : "dkh 10/20/2008 14:50",
"asDateAndTime" : "DaleHenrichs 02/17/2011 16:40",
"asInteger" : "dkh 10/19/2011 21:44",
"asInteger" : "dkh 10/19/2011 21:43",
"asNumber" : "dkh 03/24/2011 15:02",
"asText" : "dkh 10/20/2008 15:20",
"asTime" : "DaleHenrichs 02/17/2011 16:48",
Expand Down Expand Up @@ -39,7 +39,7 @@
"gemstoneMatch:" : "dkh 04/28/2008 09:17",
"getEnclosedExpressionFrom:" : "dkh 10/22/2008 11:46",
"includesSubString:" : "dkh 10/20/2008 15:11",
"includesSubstring:" : "dkh 03/11/2013 16:16:42",
"includesSubstring:" : "dkh 07/18/2013 07:45",
"includesSubstring:caseSensitive:" : "dkh 09/22/2008 17:21",
"indexOfAnyOf:startingAt:" : "dkh 10/20/2008 15:23",
"isAllDigits" : "dkh 10/20/2008 15:24",
Expand All @@ -66,6 +66,6 @@
"unescapePercents" : "dkh 10/20/2008 15:33",
"withBlanksTrimmed" : "dkh 10/20/2008 14:43",
"withFirstCharacterDownshifted" : "dkh 10/22/2008 11:36",
"withSeparatorsCompacted" : "dkh 10/28/2009 11:24",
"withSeparatorsCompacted" : "DaleHenrichs 01/28/2010 16:19",
"withoutLeadingBlanks" : "dkh 02/18/2009 13:53",
"withoutTrailingBlanks" : "DaleHenrichs 02/17/2011 16:50" } }
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
"select:thenCollect:" : "",
"select:thenDo:" : "rjl 04/28/2009 12:46",
"sortBy:" : "",
"sum" : "DaleHenrichs 08/27/2010 12:40",
"sum" : "DaleHenrichs 10/25/2010 16:01",
"union:" : "dkh 06/13/2007 14:07" } }
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"class" : {
"current" : "dkh 10/25/2007 14:23",
"daysInMonth:forYear:" : "",
"fromDays:" : "DaleHenrichs 08/18/2010 14:33",
"fromDays:" : "DaleHenrichs 10/25/2010 16:01",
"fromSeconds:" : "dkh 03/19/2009 16:41",
"indexOfMonth:" : "dkh 09/26/2008 10:21",
"julianDayNumber:" : "DaleHenrichs 08/18/2010 14:33",
"julianDayNumber:" : "DaleHenrichs 10/25/2010 16:01",
"nameOfDay:" : "",
"readFrom:" : "dkh 10/10/2008 11:28",
"tomorrow" : "rjl 04/28/2009 10:22",
Expand All @@ -19,17 +19,17 @@
"asDuration" : "rjl 04/28/2009 12:43",
"asMonth" : "",
"asSeconds" : "rjl 04/28/2009 12:42",
"dayMonthYearDo:" : "DaleHenrichs 08/18/2010 14:33",
"dayMonthYearDo:" : "DaleHenrichs 10/25/2010 16:01",
"dayOfWeekName" : "rjl 04/28/2009 12:43",
"julianDayNumber" : "DaleHenrichs 08/18/2010 14:33",
"julianDayNumber" : "DaleHenrichs 10/25/2010 16:01",
"next" : "DataCurator 04/23/2007 14:43",
"onNextMonth" : "daniel 05/13/2005 15:15",
"onPreviousMonth" : "daniel 05/13/2005 15:15",
"previous" : "rjl 04/28/2009 12:43",
"printFormat:" : "dkh 07/16/2007 10:09",
"printOn:format:" : "dkh 12/10/2009 16:50",
"printOn:format:" : "DaleHenrichs 01/28/2010 16:19",
"start" : "DataCurator 04/23/2007 14:43",
"to:" : "rjl 04/28/2009 12:43",
"weekday" : "dkh 12/10/2009 16:51",
"weekdayIndex" : "DaleHenrichs 08/18/2010 14:33",
"weekday" : "DaleHenrichs 01/28/2010 16:19",
"weekdayIndex" : "DaleHenrichs 10/25/2010 16:01",
"yyyymmdd" : "" } }
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"class" : {
"date:time:" : "DaleHenrichs 08/20/2010 14:46",
"date:time:offset:" : "DaleHenrichs 08/20/2010 14:45",
"julianDayNumber:" : "DaleHenrichs 07/29/2010 16:11",
"date:time:" : "DaleHenrichs 10/25/2010 16:01",
"date:time:offset:" : "DaleHenrichs 10/25/2010 16:01",
"julianDayNumber:" : "DaleHenrichs 10/25/2010 14:42",
"localTimeZone" : "dkh 10/01/2008 15:36",
"localTimeZone:" : "dkh 10/01/2008 16:03",
"midnight" : "dkh 03/12/2008 19:38",
Expand All @@ -18,13 +18,13 @@
"asRFC1123StringOn:" : "dkh 03/03/2008 15:12",
"asSortableString" : "DaleHenrichs 02/26/2010 11:56",
"asString" : "dkh 10/21/2008 14:28",
"asTime" : "DaleHenrichs 08/20/2010 15:01",
"asTime" : "DaleHenrichs 10/25/2010 16:01",
"asTimeStamp" : "dkh 07/31/2012 16:47",
"asWeek" : "",
"date" : "",
"dayMonthYearDo:" : "",
"dayOfWeekGmt" : "dkh 03/03/2008 15:11",
"julianDayNumber" : "DaleHenrichs 07/29/2010 16:37",
"julianDayNumber" : "DaleHenrichs 10/25/2010 14:42",
"midnight" : "",
"monthIndex" : "dkh 01/27/2008 08:54",
"nanoSecond" : "",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"class" : {
"fromString:" : "DaleHenrichs 08/20/2010 09:16",
"fromString:" : "DaleHenrichs 10/25/2010 16:01",
"readFrom:" : "DaleHenrichs 10/25/2010 17:23" },
"instance" : {
"dayOfWeek" : "dkh 03/23/2011 16:40",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"class" : {
"deprecationsWhile:" : "eem 7/3/2009 19:13",
"method:explanation:on:in:" : "eem 7/3/2009 19:15" },
"deprecationsWhile:" : "DaleHenrichs 10/25/2010 16:01",
"method:explanation:on:in:" : "DaleHenrichs 10/25/2010 16:01" },
"instance" : {
"=" : "eem 7/3/2009 19:10",
"=" : "DaleHenrichs 10/25/2010 16:01",
"defaultAction" : "DaleHenrichs 10/25/2010 16:04",
"deprecationDate" : "eem 7/3/2009 19:07",
"explanationString" : "eem 7/3/2009 19:07",
"hash" : "eem 7/3/2009 19:08",
"messageText" : "AndrewBlack 8/31/2009 03:15",
"method:explanation:on:in:" : "DaleHenrichs 08/12/2010 14:50",
"methodReference" : "eem 7/3/2009 19:07",
"versionString" : "eem 7/3/2009 19:07" } }
"deprecationDate" : "DaleHenrichs 10/25/2010 16:01",
"explanationString" : "DaleHenrichs 10/25/2010 16:01",
"hash" : "DaleHenrichs 10/25/2010 16:01",
"messageText" : "DaleHenrichs 10/25/2010 16:01",
"method:explanation:on:in:" : "DaleHenrichs 10/25/2010 16:01",
"methodReference" : "DaleHenrichs 10/25/2010 16:01",
"versionString" : "DaleHenrichs 10/25/2010 16:01" } }
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"class" : {
"days:" : "",
"days:hours:minutes:seconds:nanoSeconds:" : "jgf 02/03/2009 11:17",
"fromString:" : "DaleHenrichs 08/20/2010 09:33",
"fromString:" : "DaleHenrichs 10/25/2010 16:01",
"hours:" : "",
"milliSeconds:" : "jgf 02/03/2009 11:16",
"minutes:" : "",
Expand All @@ -14,5 +14,5 @@
"asMilliSeconds" : "dkh 01/28/2008 09:39",
"asNanoSeconds" : "DataCurator 04/23/2007 14:43",
"asString" : "dkh 10/30/2007 16:14",
"isZero" : "DaleHenrichs 06/03/2010 11:26",
"isZero" : "DaleHenrichs 10/25/2010 14:42",
"nanoSeconds" : "DataCurator 04/23/2007 14:43" } }
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"class" : {
"fooIssue157" : "DaleHenrichs 08/18/2010 13:13" },
"fooIssue157" : "DaleHenrichs 10/25/2010 16:01" },
"instance" : {
"doesNotUnderstand:" : "DaleHenrichs 08/18/2010 13:12",
"doesNotUnderstand:" : "DaleHenrichs 10/25/2010 16:01",
"testIssue157" : "DaleHenrichs 10/25/2010 16:01" } }
Original file line number Diff line number Diff line change
@@ -1,30 +1,32 @@
http
getResponseUpTo: markerString
"Keep reading until the marker is seen. Return three parts: header, marker, beginningOfData. Fails if no marker in first 2000 chars."
"Keep reading until the marker is seen. Return three parts: header, marker, beginningOfData. Fails if no marker in first 2000 chars."

| buf response bytesRead tester mm tries |
buf := ByteArray new: 2000.
response := WriteStream on: ByteArray new.
tester := 1. mm := 1.
tries := 3.
[tester := tester - markerString size + 1 max: 1. "rewind a little, in case the marker crosses a read boundary"
tester to: response position - 1 do: [:tt |
(Character value: (buf at: tt)) = (markerString at: mm)
ifTrue: [mm := mm + 1]
ifFalse: [mm := 1 ].
"Not totally correct for markers like xx0xx"
mm > markerString size ifTrue: ["got it"
^ Array with: (buf asString copyFrom: 1 to: tt+1-mm)
with: markerString
with: (buf asString copyFrom: tt+1 to: response position - 1)]].
tester := 1 max: response position. "OK if mm in the middle"
(response position < buf size) & (self isActive | self readyForRead)
& ((tries := tries - 1) >= 0) ] whileTrue: [
(self waitForReadDataUpToMs: 500) ifFalse: [
self error: 'data was late'].
bytesRead := self readInto: buf startingAt: 1 for: buf size.
response nextPutAll: (buf copyFrom: 1 to: bytesRead)].

^ Array with: response contents asString
with: ''
with: '' "Marker not found and connection closed"
| buf response bytesRead tester mm tries |
buf := ByteArray new: 2000.
response := WriteStream on: ByteArray new.
tester := 1.
mm := 1.
tries := 3.
[
tester := tester - markerString size + 1 max: 1. "rewind a little, in case the marker crosses a read boundary"
tester to: response position - 1 do: [ :tt |
(Character value: (buf at: tt)) = (markerString at: mm)
ifTrue: [ mm := mm + 1 ]
ifFalse: [ mm := 1 ]. "Not totally correct for markers like xx0xx"
mm > markerString size
ifTrue: [
"got it"
^ Array
with: (buf asString copyFrom: 1 to: tt + 1 - mm)
with: markerString
with: (buf asString copyFrom: tt + 1 to: response position - 1) ] ].
tester := 1 max: response position. "OK if mm in the middle"
response position < buf size & (self isActive | self readyForRead)
& ((tries := tries - 1) >= 0) ]
whileTrue: [
(self waitForReadDataUpToMs: 20000)
ifFalse: [ self error: 'data was late' ].
bytesRead := self readInto: buf startingAt: 1 for: buf size.
response nextPutAll: (buf copyFrom: 1 to: bytesRead) ].
^ Array with: response contents asString with: '' with: '' "Marker not found and connection closed"
Original file line number Diff line number Diff line change
@@ -1,34 +1,41 @@
http
getResponseUpTo: markerString ignoring: ignoreString
"Keep reading, until the marker is seen, skipping characters in ignoreString when
"Keep reading, until the marker is seen, skipping characters in ignoreString when
comparing to the marker. Return three parts: header, marker, beginningOfData.
Fails if no marker in first 2000 chars."
Fails if no marker in first 2000 chars."

| buf response bytesRead tester mm skipped |
buf _ ByteArray new: 2000.
response _ WriteStream on: ByteArray new.
tester _ 1. mm _ 1.
skipped _ 0.
[tester _ tester - markerString size + 1 max: 1. "rewind a little, in case the marker crosses a read boundary"
tester to: response position - 1 do: [:tt |
(Character value: (buf at: tt)) = (markerString at: mm) ifFalse:
[[ignoreString includes: (markerString at: mm)] whileTrue:
[mm _ mm + 1. skipped _ skipped + 1]].
(Character value: (buf at: tt)) = (markerString at: mm)
ifTrue: [mm _ mm + 1]
ifFalse: [mm _ 1. skipped _ 0].
"Not totally correct for markers like xx0xx"
mm > markerString size ifTrue: ["got it"
^ Array with: (buf asString copyFrom: 1 to: tt+1-mm+skipped)
with: markerString
with: (buf asString copyFrom: tt+1 to: response position - 1)]].
tester _ 1 max: response position. "OK if mm in the middle"
(response position < buf size) & (self isActive | self readyForRead)] whileTrue: [
(self waitForReadDataUpToMs: 500) ifFalse: [
self error: 'data was late'].
bytesRead _ self readInto: buf startingAt: 1 for: buf size.
response nextPutAll: (buf copyFrom: 1 to: bytesRead)].

^ Array with: response contents asString
with: ''
with: '' "Marker not found and connection closed"
| buf response bytesRead tester mm skipped |
buf _ ByteArray new: 2000.
response _ WriteStream on: ByteArray new.
tester _ 1.
mm _ 1.
skipped _ 0.
[
tester _ tester - markerString size + 1 max: 1. "rewind a little, in case the marker crosses a read boundary"
tester to: response position - 1 do: [ :tt |
(Character value: (buf at: tt)) = (markerString at: mm)
ifFalse: [
[ ignoreString includes: (markerString at: mm) ]
whileTrue: [
mm _ mm + 1.
skipped _ skipped + 1 ] ].
(Character value: (buf at: tt)) = (markerString at: mm)
ifTrue: [ mm _ mm + 1 ]
ifFalse: [
mm _ 1.
skipped _ 0 ]. "Not totally correct for markers like xx0xx"
mm > markerString size
ifTrue: [
"got it"
^ Array
with: (buf asString copyFrom: 1 to: tt + 1 - mm + skipped)
with: markerString
with: (buf asString copyFrom: tt + 1 to: response position - 1) ] ].
tester _ 1 max: response position. "OK if mm in the middle"
response position < buf size & (self isActive | self readyForRead) ]
whileTrue: [
(self waitForReadDataUpToMs: 20000)
ifFalse: [ self error: 'data was late' ].
bytesRead _ self readInto: buf startingAt: 1 for: buf size.
response nextPutAll: (buf copyFrom: 1 to: bytesRead) ].
^ Array with: response contents asString with: '' with: '' "Marker not found and connection closed"
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"class" : {
"addProxyExceptions:" : "FirstnameLastname 09/02/2009 07:52",
"addProxyExceptions:" : "DaleHenrichs 01/28/2010 16:19",
"argString:" : "dkh 09/26/2008 10:00",
"defaultPort" : "DataCurator 04/23/2007 14:43",
"expandUrl:ip:port:" : "DataCurator 04/23/2007 14:43",
Expand All @@ -21,7 +21,7 @@
"httpProxyServer" : "obi 02/08/2008 11:42",
"httpProxyServer:" : "obi 02/08/2008 11:43",
"httpProxyUser" : "dkh 08/06/2012 09:25",
"httpPut:to:user:passwd:" : "dkh 06/20/2012 09:05",
"httpPut:to:user:passwd:" : "dkh 06/20/2012 08:57",
"initHTTPSocket:timeoutSecs:ifError:" : "OttoBehrens 02/21/2011 20:37",
"initHTTPSocket:wait:ifError:" : "dkh 08/19/2009 12:18",
"initialize" : "dkh 08/19/2009 12:06",
Expand All @@ -35,8 +35,8 @@
"instance" : {
"getHeader:" : "DataCurator 04/23/2007 14:43",
"getHeader:default:" : "DataCurator 04/23/2007 14:43",
"getResponseUpTo:" : "dkh 08/19/2009 12:16",
"getResponseUpTo:ignoring:" : "DataCurator 04/23/2007 14:43",
"getResponseUpTo:" : "dkh 03/23/2015 13:23",
"getResponseUpTo:ignoring:" : "dkh 03/23/2015 16:19",
"getRestOfBuffer:" : "DaleHenrichs 05/05/2010 14:56",
"getRestOfBuffer:totalLength:" : "dkh 11/27/2007 12:04",
"header:" : "DataCurator 04/23/2007 14:43",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
],
"classvars" : [
],
"commentStamp" : "DataCurator 07/13/2010 15:39",
"commentStamp" : "",
"instvars" : [
],
"name" : "HttpFormDictionary",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"bitClear:" : "OttoBehrens 02/22/2011 22:35",
"hashMultiply" : "dkh 02/12/2009 16:48",
"isInteger" : "",
"isLarge" : "DaleHenrichs 08/18/2010 14:33",
"isLarge" : "DaleHenrichs 10/25/2010 16:01",
"printPaddedWith:to:" : "jgf 02/03/2009 10:29",
"printPaddedWith:to:base:" : "",
"printStringBase:" : "dkh 07/05/2007 17:23",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
},
"instance" : {
"_at:" : "DaleHenrichs 10/25/2010 14:42",
"copy" : "dkh 11/09/2009 14:50",
"first:" : "dkh 11/09/2009 14:40",
"species" : "DaleHenrichs 06/03/2010 11:36" } }
"copy" : "DaleHenrichs 01/28/2010 16:19",
"first:" : "DaleHenrichs 01/28/2010 16:19",
"species" : "DaleHenrichs 10/25/2010 14:42" } }

0 comments on commit d08b2db

Please sign in to comment.