[squeak-dev] The Trunk: Network-fbs.140.mcz

David T. Lewis lewis at mail.msen.com
Sat Mar 2 21:40:44 UTC 2013


On Sat, Mar 02, 2013 at 06:40:10PM +0000, Frank Shearar wrote:
> I reproduce it typically by not having a network connection!
> 
> OK, so the solution is more complicated: NetNameResolver >>
> #addressForName:timeout: must have a way of signalling not only a name
> lookup failure (which loops via the exception's defaultAction) but
> also a name lookup failure where the user gives up. Given the return
> values, how about
> 
>     result := NetNameResolver addressForName: 'foo' timeout: 20.
>     (NetNameResolver useOldNetwork and: [result = #[0 0 0 0]])
>         ifTrue: ["Signal failure"].
>     (NetNameResolver useOldNetwork not and: [result isNil])
>         ifTrue: ["Signal failure"].
> 
> ?
> 
> frank
> 

I would think that just a check for nil or #[0 0 0 0] would be sufficient,
regardless of the useOldNetwork setting.

  (hostIP isNil or: [hostIP = #[0 0 0 0]])
    ifTrue: ["Signal failure"].

I am also not sure if different platforms handle this the same way (I would
want to at least check Windows, though I can't do that right now). But my
guess is that checking for nil or #[0 0 0 0] is likely to do the right thing
an any case, regardless of platform differences (if any).

Dave

> On 2 March 2013 16:02, David T. Lewis <lewis at mail.msen.com> wrote:
> > I am not sure how to reproduce the original problem (on Linux), but I'm
> > not sure if the proposed fix will work if the IPv6 networking is disabled
> > in preferences. The resolver behaves differently depending on whether the
> > new network primitives are being used, and may answer #[0 0 0 0] rather
> > than nil.
> >
> > NetNameResolver useOldNetwork: true.
> > NetNameResolver addressForName: 'foo' timeout: 20 ==> #[0 0 0 0]
> >
> > NetNameResolver useOldNetwork: false.
> > NetNameResolver addressForName: 'foo' timeout: 20 ==> nil
> >
> > Dave
> >
> > On Fri, Mar 01, 2013 at 10:39:44AM +0000, commits at source.squeak.org wrote:
> >> Frank Shearar uploaded a new version of Network to project The Trunk:
> >> http://source.squeak.org/trunk/Network-fbs.140.mcz
> >>
> >> ==================== Summary ====================
> >>
> >> Name: Network-fbs.140
> >> Author: fbs
> >> Time: 1 March 2013, 10:39:25.076 am
> >> UUID: 9f6d4989-84fc-4303-87ab-406d2296fd73
> >> Ancestors: Network-fbs.139
> >>
> >> If the user gives up on trying to resolve a name, fail the socket connect completely.
> >>
> >> http://bugs.squeak.org/view.php?id=4025.
> >>
> >> =============== Diff against Network-fbs.139 ===============
> >>
> >> Item was changed:
> >>   ----- Method: SocketStream class>>openConnectionToHostNamed:port: (in category 'instance creation') -----
> >>   openConnectionToHostNamed: hostName port: portNumber
> >>       | hostIP |
> >>       hostIP := NetNameResolver addressForName: hostName timeout: 20.
> >> +     hostIP ifNil: [NetworkError signal: ('Cannot resolve {1}.' format: {hostName})].
> >>       ^self openConnectionToHost: hostIP port: portNumber!
> >


More information about the Squeak-dev mailing list