forked from svenvc/zinc
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #66 from GsDevKit/issue_58
release v2.4.3.1
- Loading branch information
Showing
469 changed files
with
3,404 additions
and
823 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
"class" : { | ||
}, | ||
"instance" : { | ||
"baseline:" : "dkh 11/17/2014 18:15" } } | ||
"baseline:" : "dkh 01/12/2015 10:56" } } |
2 changes: 1 addition & 1 deletion
2
repository/BaselineOfZincHTTPComponents.package/monticello.meta/version
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
...itory/SocketStream.package/SocketStream.class/class/openConnectionToHost.port.timeout..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
as yet unclassified | ||
openConnectionToHost: host port: portNumber timeout: timeoutSeconds | ||
| socket | | ||
socket := SocketStreamSocket newTCPSocket. | ||
socket connectTo: host port: portNumber timeout: timeoutSeconds. | ||
^ (self on: socket) | ||
timeout: timeoutSeconds; | ||
yourself |
9 changes: 5 additions & 4 deletions
9
repository/SocketStream.package/SocketStream.class/instance/close.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
as yet unclassified | ||
close | ||
"Flush any data still not sent | ||
"Flush any data still not sent | ||
and take care of the socket." | ||
|
||
self flush. | ||
socket close. | ||
self destroy. | ||
[ self flush ] | ||
ensure: [ | ||
self socket close. | ||
self destroy ] |
5 changes: 3 additions & 2 deletions
5
repository/SocketStream.package/SocketStream.class/instance/destroy.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
as yet unclassified | ||
destroy | ||
"Destroy the receiver and its underlying socket. Does not attempt to flush the output buffers. For a graceful close use SocketStream>>close instead." | ||
socket ifNotNil: [socket close] | ||
"Destroy the receiver and its underlying socket. Does not attempt to flush the output buffers. For a graceful close use SocketStream>>close instead." | ||
|
||
socket ifNotNil: [ self socket close ] |
18 changes: 11 additions & 7 deletions
18
repository/SocketStream.package/SocketStream.class/instance/flush.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
as yet unclassified | ||
flush | ||
"If the other end is connected and we have something | ||
"If the other end is connected and we have something | ||
to send, then we send it and reset the outBuffer." | ||
|
||
((outNextToWrite > 1) and: [socket isActive]) | ||
ifTrue: [ | ||
[socket sendData: outBuffer count: outNextToWrite - 1] | ||
on: ConnectionTimedOut | ||
do: [:ex | shouldSignal ifFalse: ["swallow"]]. | ||
outNextToWrite := 1] | ||
(outNextToWrite > 1 and: [ self socket isActive ]) | ||
ifTrue: [ | ||
[ self socket sendData: outBuffer count: outNextToWrite - 1 ] | ||
on: ConnectionTimedOut | ||
do: [ :ex | | ||
shouldSignal | ||
ifFalse: [ | ||
"swallow" | ||
] ]. | ||
outNextToWrite := 1 ] |
21 changes: 12 additions & 9 deletions
21
repository/SocketStream.package/SocketStream.class/instance/flushComet.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
as yet unclassified | ||
flushComet | ||
"Flushes the receiver and answer if the socket is still in a valid state and both ends are properly connected. Free the socket, as a side-effect if there is a problem." | ||
|
||
| result | | ||
result := [ self flush. true ] | ||
on: NetworkError | ||
do: [ :err | false ]. | ||
result := result and: [ self isConnected and: [ self isOtherEndConnected ] ]. | ||
result ifFalse: [ socket destroy ]. | ||
^ result | ||
"Flushes the receiver and answer if the socket is still in a valid state and both ends are properly connected. Free the socket, as a side-effect if there is a problem." | ||
|
||
| result | | ||
result := [ | ||
self flush. | ||
true ] | ||
on: NetworkError | ||
do: [ :err | false ]. | ||
result := result and: [ self isConnected and: [ self isOtherEndConnected ] ]. | ||
result | ||
ifFalse: [ self socket destroy ]. | ||
^ result |
4 changes: 2 additions & 2 deletions
4
repository/SocketStream.package/SocketStream.class/instance/isConnected.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
as yet unclassified | ||
isConnected | ||
"The stream is connected if the socket is." | ||
"The stream is connected if the socket is." | ||
|
||
^socket isConnected | ||
^ self socket isConnected |
16 changes: 10 additions & 6 deletions
16
repository/SocketStream.package/SocketStream.class/instance/isDataAvailable.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,17 @@ | ||
as yet unclassified | ||
isDataAvailable | ||
"It the inbuffer is empty, we check the socket for data. | ||
"It the inbuffer is empty, we check the socket for data. | ||
If it claims to have data available to read, we try to read | ||
some once and recursively call this method again. | ||
If something really was available it is now in the inBuffer. | ||
This is because there has been spurious | ||
dataAvailable when there really is no data to get." | ||
|
||
self isInBufferEmpty ifFalse: [^true]. | ||
^socket dataAvailable | ||
ifFalse: [false] | ||
ifTrue: [self receiveDataIfAvailable; isDataAvailable] | ||
|
||
self isInBufferEmpty | ||
ifFalse: [ ^ true ]. | ||
^ self socket dataAvailable | ||
ifFalse: [ false ] | ||
ifTrue: [ | ||
self | ||
receiveDataIfAvailable; | ||
isDataAvailable ] |
2 changes: 1 addition & 1 deletion
2
repository/SocketStream.package/SocketStream.class/instance/isOtherEndConnected.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
as yet unclassified | ||
isOtherEndConnected | ||
^socket isConnected | ||
^ self socket isConnected |
23 changes: 15 additions & 8 deletions
23
repository/SocketStream.package/SocketStream.class/instance/nextPutAllFlush..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,21 @@ | ||
as yet unclassified | ||
nextPutAllFlush: aCollection | ||
"Put a String or a ByteArray onto the stream. | ||
"Put a String or a ByteArray onto the stream. | ||
You can use this if you have very large data - it avoids | ||
copying into the buffer (and avoids buffer growing) | ||
and also flushes any other pending data first." | ||
|
||
| toPut | | ||
toPut := binary ifTrue: [aCollection asByteArray] ifFalse: [aCollection asString]. | ||
self flush. "first flush pending stuff, then directly send" | ||
socket isConnected ifTrue: [ | ||
[socket sendData: toPut count: toPut size] | ||
on: ConnectionTimedOut | ||
do: [:ex | shouldSignal ifFalse: ["swallow"]]] | ||
| toPut | | ||
toPut := binary | ||
ifTrue: [ aCollection asByteArray ] | ||
ifFalse: [ aCollection asString ]. | ||
self flush. "first flush pending stuff, then directly send" | ||
self socket isConnected | ||
ifTrue: [ | ||
[ self socket sendData: toPut count: toPut size ] | ||
on: ConnectionTimedOut | ||
do: [ :ex | | ||
shouldSignal | ||
ifFalse: [ | ||
"swallow" | ||
] ] ] |
10 changes: 6 additions & 4 deletions
10
repository/SocketStream.package/SocketStream.class/instance/receiveAvailableData.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
as yet unclassified | ||
receiveAvailableData | ||
"Receive available data (as much as fits in the inBuffer) | ||
"Receive available data (as much as fits in the inBuffer) | ||
but not waiting for more to arrive. | ||
Return the position in the buffer where the | ||
new data starts, regardless if anything | ||
was read, see #adjustInBuffer." | ||
|
||
recentlyRead := socket receiveAvailableDataInto: inBuffer startingAt: inNextToWrite. | ||
^self adjustInBuffer: recentlyRead | ||
|
||
recentlyRead := self socket | ||
receiveAvailableDataInto: inBuffer | ||
startingAt: inNextToWrite. | ||
^ self adjustInBuffer: recentlyRead |
39 changes: 21 additions & 18 deletions
39
repository/SocketStream.package/SocketStream.class/instance/receiveData.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,31 @@ | ||
as yet unclassified | ||
receiveData | ||
"Receive data with timeout if it has been set. | ||
"Receive data with timeout if it has been set. | ||
If shouldSignal is false we use the Socket methods | ||
that swallow those Exceptions, if it is true the | ||
caller will have to handle those Exceptions. | ||
Return the position in the buffer where the | ||
new data starts, regardless if anything | ||
was read, see #adjustInBuffer." | ||
|
||
recentlyRead := shouldSignal ifTrue: [ | ||
self shouldTimeout ifTrue: [ | ||
socket receiveDataSignallingTimeout: timeout | ||
into: inBuffer startingAt: inNextToWrite] | ||
ifFalse: [ | ||
socket receiveDataSignallingClosedInto: inBuffer | ||
startingAt: inNextToWrite]] | ||
ifFalse: [ | ||
self shouldTimeout ifTrue: [ | ||
"This case is tricky, if it times out and is swallowed | ||
|
||
recentlyRead := shouldSignal | ||
ifTrue: [ | ||
self shouldTimeout | ||
ifTrue: [ | ||
self socket | ||
receiveDataSignallingTimeout: timeout | ||
into: inBuffer | ||
startingAt: inNextToWrite ] | ||
ifFalse: [ self socket receiveDataSignallingClosedInto: inBuffer startingAt: inNextToWrite ] ] | ||
ifFalse: [ | ||
self shouldTimeout | ||
ifTrue: [ | ||
"This case is tricky, if it times out and is swallowed | ||
how does other methods calling this method repeatedly | ||
get to know that? And what should they do?" | ||
socket receiveDataTimeout: timeout | ||
into: inBuffer startingAt: inNextToWrite] | ||
ifFalse: [ | ||
socket receiveDataInto: inBuffer | ||
startingAt: inNextToWrite]]. | ||
^self adjustInBuffer: recentlyRead | ||
self socket | ||
receiveDataTimeout: timeout | ||
into: inBuffer | ||
startingAt: inNextToWrite ] | ||
ifFalse: [ self socket receiveDataInto: inBuffer startingAt: inNextToWrite ] ]. | ||
^ self adjustInBuffer: recentlyRead |
8 changes: 5 additions & 3 deletions
8
repository/SocketStream.package/SocketStream.class/instance/receiveDataIfAvailable.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
as yet unclassified | ||
receiveDataIfAvailable | ||
"Only used to check that there really is data to read | ||
"Only used to check that there really is data to read | ||
from the socket after it signals dataAvailable. | ||
It has been known to signal true and then still | ||
not have anything to read. See also isDataAvailable. | ||
Return the position in the buffer where the | ||
new data starts, regardless if anything | ||
was read, see #adjustInBuffer." | ||
|
||
recentlyRead := socket receiveSomeDataInto: inBuffer startingAt: inNextToWrite. | ||
^self adjustInBuffer: recentlyRead | ||
recentlyRead := self socket | ||
receiveSomeDataInto: inBuffer | ||
startingAt: inNextToWrite. | ||
^ self adjustInBuffer: recentlyRead |
2 changes: 1 addition & 1 deletion
2
repository/SocketStream.package/SocketStream.class/instance/socket..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
as yet unclassified | ||
socket: aSocket | ||
socket := aSocket | ||
socket := TransientStackValue value: aSocket |
2 changes: 1 addition & 1 deletion
2
repository/SocketStream.package/SocketStream.class/instance/socket.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
as yet unclassified | ||
socket | ||
^socket | ||
^ socket value |
Oops, something went wrong.