From VisualWorks®, 7.6 of March 3, 2008 on May 7, 2008 at 2:37:29 pm
Smalltalk.Opentalk defineClass: #StreamTransport
superclass: #{Opentalk.RequestTransport}
indexedType: #none
private: false
instanceVariableNames: 'id peerId writeStream readStream '
classInstanceVariableNames: ''
imports: ''
category: 'Opentalk-Core'
attributes: #(
#(#package 'Opentalk-Prerequisites'))
Opentalk.StreamTransport
StreamTransport is the abstract superclass of connection-oriented transports.
Subclasses must implement the following messages:
Instance protocol:
initialize-release
initializeStreams
protocol-API
peerOK
Class protocol:
private
new:socketTo:for:
Instance Variables:
id <Object> canonicalized peer address
writeStream <Stream> outgoing stream
readStream <Stream> incoming stream
Opentalk.ConnectionAdaptor connection-API
connectionStopped: aTransport
"... invoked from aTransport after it has been stopped."
(clientConnections includesKey: aTransport peerId)
ifTrue: [ self removingConnection: aTransport.
clientConnections removeKey: aTransport peerId ifAbsent: [nil] ]
ifFalse: [ self removingServerConnection: aTransport ].
self privateConnectionStopped: aTransport
Opentalk.StreamTransport accessing
peerId
^peerId
Opentalk.StreamTransport stst
peerAccessPoint: address
peerId := address.
manager peerAccessPointFor: self is: address
Opentalk.TCPTransport protocol-API
commenceTimeOut
^manager clientConnections
at: self peerId
ifAbsent: [ "self is the server side of an asymmetric connection"
true ]
ifPresent: [ :t |
self == t
ifTrue: [ self hasPendingRequests
ifTrue: [ false ]
ifFalse: [ "Retract the transport so that someone doesn't start sending before we manage to shut it down"
manager clientConnections removeKey: self id ifAbsent: [].
true ] ]
ifFalse: [ "Another transport already replaced me (unusual)"
true ] ]
Opentalk.TCPTransport printing
printAccessInfoOn: aStream
super printAccessInfoOn: aStream.
id notNil ifTrue: [
aStream nextPut: $/.
id hostAddress
do: [ :e | aStream print: e ]
separatedBy: [ aStream nextPut: $.].
aStream nextPut: $:.
id port printOn: aStream].
peerId ifNotNil: [
aStream nextPut: $(;
print: peerId port;
nextPut: $) ]