Fixes bug 205437: socket errors not being reported
This commit is contained in:
parent
884f3fe921
commit
fc92ec8e9f
|
@ -17,6 +17,7 @@
|
|||
(let ([s (tcp-server-socket-nonblocking
|
||||
(or (string->number port)
|
||||
(error who "invalid port number" port)))])
|
||||
(printf "Listening on port ~a\n" port)
|
||||
(call/cc
|
||||
(lambda (k)
|
||||
(with-exception-handler k
|
||||
|
|
|
@ -2073,7 +2073,7 @@
|
|||
(define (set-fd-nonblocking fd who id)
|
||||
(let ([rv (foreign-call "ikrt_make_fd_nonblocking" fd)])
|
||||
(unless (eq? rv 0)
|
||||
(io-error who id fd))))
|
||||
(io-error who id rv))))
|
||||
|
||||
(define (socket->ports socket who id block?)
|
||||
(if (< socket 0)
|
||||
|
|
|
@ -158,27 +158,29 @@ do_connect(ikptr host, ikptr srvc, int socket_type){
|
|||
return fix(-1);
|
||||
}
|
||||
struct addrinfo* i = info;
|
||||
int sock = -1;
|
||||
ikptr sock = fix(-1);
|
||||
while(i){
|
||||
if(i->ai_socktype != socket_type){
|
||||
i = i->ai_next;
|
||||
} else {
|
||||
int s = socket(i->ai_family, i->ai_socktype, i->ai_protocol);
|
||||
if(s < 0){
|
||||
sock = ikrt_io_error();
|
||||
i = i->ai_next;
|
||||
} else {
|
||||
int err = connect(s, i->ai_addr, i->ai_addrlen);
|
||||
if(err < 0){
|
||||
sock = ikrt_io_error();
|
||||
i = i->ai_next;
|
||||
} else {
|
||||
sock = s;
|
||||
sock = fix(s);
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
freeaddrinfo(info);
|
||||
return fix(sock);
|
||||
return sock;
|
||||
}
|
||||
|
||||
ikptr
|
||||
|
|
Loading…
Reference in New Issue