On 11/11/2010 03:32 PM, Paolo Bonzini wrote:
> On 11/07/2010 09:55 PM, Holger Hans Peter Freyther wrote:

>>
>> and this is silently on the GST shell when I CTRL+C and listen again. So the
>> old ServerSocket is still around when I create the new one.
> 
> Do you have a strace?  It should raise an exception:
> 
>     [(self
>         bind: fd
>         to: addr
>         addrLen: addr size) < 0 ifTrue: [File checkError: self soError]
>             ifCurtailed: [self close].

Hi,

it took me a bit. So below is the test case, the result in terms of netstat,
the output of strace. So the bind is failing but the socket has no SOL_ERROR
at all... instead we end up listening (didn't see that) on a socket that is
not properly configured.

>From a quick look at the socket/ipv4/ipv6 impl I don't see anyone assigning
sk_err to anything in case of a failed bind, so I am not sure where the
SO_ERROR != 0 on failed bind is coming from.



st> server1 := Sockets.ServerSocket port: 8080 bindTo: addr.
Sockets.ServerSocket[127.0.0.1:8080]
st> server2 := Sockets.ServerSocket port: 8080 bindTo: addr.
Sockets.ServerSocket[0.0.0.0:0]

on netstat this is looking like this:
tcp  0 0 0.0.0.0:59247 0.0.0.0:*  LISTEN      28233/gst
tcp  0 0 127.0.0.1:8080 0.0.0.0:* LISTEN      28233/gst

and on strace:
socket(PF_INET, SOCK_STREAM|SOCK_CLOEXEC, IPPROTO_TCP) = 6
rt_sigprocmask(SIG_BLOCK, ~[QUIT ILL ABRT BUS SEGV RTMIN RT_1], [], 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
... too many of these...
setsockopt(6, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
bind(6, {sa_family=AF_INET, sin_port=htons(8080),
sin_addr=inet_addr("127.0.0.1")}, 16) = -1 EADDRINUSE (Address already in use)

getsockopt(6, SOL_SOCKET, SO_ERROR, [0], [4]) = 0

getsockname(6, {sa_family=AF_INET, sin_port=htons(0),
sin_addr=inet_addr("0.0.0.0")}, [16]) = 0

_______________________________________________
help-smalltalk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-smalltalk

Reply via email to