The Trunk: Network-nice.52.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Network-nice.52.mcz

commits-2
Nicolas Cellier uploaded a new version of Network to project The Trunk:
http://source.squeak.org/trunk/Network-nice.52.mcz

==================== Summary ====================

Name: Network-nice.52
Author: nice
Time: 18 January 2010, 7:47:01.867 pm
UUID: ee98e6ed-196c-5c4b-9505-27e7ca1447a5
Ancestors: Network-nice.51

move some temp assignment outside block

=============== Diff against Network-nice.51 ===============

Item was changed:
  ----- Method: UUIDGenerator>>makeUnixSeed (in category 'random seed') -----
  makeUnixSeed
+ ^[FileStream readOnlyFileNamed: '/dev/urandom' do: [:strm |
+ strm binary.
+ strm converter: Latin1TextConverter new.
+ Integer
+ byte1: strm next
+ byte2: strm next
+ byte3: strm next
+ byte4: strm next].
+ ] on: FileStreamException do: [nil]!
- | answer |
- [ | strm |strm := (FileStream readOnlyFileNamed: '/dev/urandom') binary.
- strm converter: Latin1TextConverter new.
- answer := Integer
- byte1: strm next
- byte2: strm next
- byte3: strm next
- byte4: strm next.
- strm close.
- ] on: FileStreamException do: [answer := nil].
- ^answer!

Item was changed:
  ----- Method: ConnectionQueue>>listenLoop (in category 'private') -----
  listenLoop
  "Private!! This loop is run in a separate process. It will establish up to maxQueueLength connections on the given port."
  "Details: When out of sockets or queue is full, retry more frequently, since a socket may become available, space may open in the queue, or a previously queued connection may be aborted by the client, making it available for a fresh connection."
  "Note: If the machine is disconnected from the network while the server is running, the currently waiting socket will go from 'isWaitingForConnection' to 'unconnected', and attempts to create new sockets will fail. When this happens, delete the broken socket and keep trying to create a socket in case the network connection is re-established. Connecting and disconnecting was tested under PPP on Mac system 8.1. It is not if this will work on other platforms."
 
 
  | newConnection |
 
  socket := Socket newTCP.
  "We'll accept four simultanous connections at the same time"
  socket listenOn: portNumber backlogSize: 4.
  "If the listener is not valid then the we cannot use the
  BSD style accept() mechanism."
  socket isValid ifFalse: [^self oldStyleListenLoop].
  [true] whileTrue: [
  socket isValid ifFalse: [
  "socket has stopped listening for some reason"
  socket destroy.
  (Delay forMilliseconds: 10) wait.
  ^self listenLoop ].
+ newConnection := [socket waitForAcceptFor: 10]
- [newConnection := socket waitForAcceptFor: 10]
  on: ConnectionTimedOut
+ do: [nil].
- do: [:ex | newConnection := nil].
  (newConnection notNil and: [newConnection isConnected]) ifTrue: [
  accessSema critical: [connections addLast: newConnection.].
  newConnection := nil.
  self changed].
  self pruneStaleConnections]. !

Item was changed:
  ----- Method: ServerDirectory>>exists (in category 'file directory') -----
  exists
  "It is difficult to tell if a directory exists.  This is ugly, but it works for writable directories.  http: will fall back on ftp for this"
 
+ | probe |
- | probe success |
- success := false.
  self isTypeFile ifTrue: [
  self entries size > 0 ifTrue: [^ true].
  probe := self newFileNamed: 'withNoName23'.
  probe ifNotNil: [
  probe close.
  probe directory deleteFileNamed: probe localName].
  ^probe notNil].
+ ^
  [client := self openFTPClient.
  [client pwd]
  ensure: [self quit].
+ true]
- success := true]
  on: Error
+ do: [:ex | false]!
- do: [:ex | ].
- ^success!

Item was changed:
  SystemOrganization addCategory: #'Network-Kernel'!
  SystemOrganization addCategory: #'Network-MailSending'!
  SystemOrganization addCategory: #'Network-Protocols'!
  SystemOrganization addCategory: #'Network-RFC822'!
  SystemOrganization addCategory: #'Network-RemoteDirectory'!
+ SystemOrganization addCategory: #'Network-URI'!
  SystemOrganization addCategory: #'Network-UUID'!
  SystemOrganization addCategory: #'Network-Url'!
- SystemOrganization addCategory: #'Network-URI'!