Rework CONNECT-SOCKET to use SELECT.
Note: this is presently broken because of a wrong input-port/output port classification of the port passed into SELECT.
This commit is contained in:
parent
d0977ea4d4
commit
c7e49f9274
|
@ -230,27 +230,27 @@
|
||||||
(else
|
(else
|
||||||
(let loop ()
|
(let loop ()
|
||||||
((structure-ref interrupts disable-interrupts!))
|
((structure-ref interrupts disable-interrupts!))
|
||||||
(let ((res (%connect (socket->fdes sock)
|
(let* ((fdes (socket->fdes sock))
|
||||||
(socket:family sock)
|
(res (%connect fdes
|
||||||
(socket-address:address name))))
|
(socket:family sock)
|
||||||
|
(socket-address:address name))))
|
||||||
(cond ((eq? res #t)
|
(cond ((eq? res #t)
|
||||||
((structure-ref interrupts enable-interrupts!)))
|
((structure-ref interrupts enable-interrupts!)))
|
||||||
(else (wait-for-channel
|
(else
|
||||||
(fdport-data:channel
|
(select '#() (vector fdes) '#())
|
||||||
(fdport-data (socket:inport sock))))
|
(if (car res)
|
||||||
(if (eq? res 0)
|
;; If connect returned EINPROGRESS, we can check
|
||||||
;; If connect returned EINPROGRESS, we can check
|
;; it's success after the next success with getsockopt
|
||||||
;; it's success after the next success with getsockopt
|
(let ((val (socket-option sock
|
||||||
(let ((val (socket-option sock
|
level/socket
|
||||||
level/socket
|
socket/error)))
|
||||||
socket/error)))
|
(if (not (zero? val))
|
||||||
(if (not (zero? val))
|
(errno-error val
|
||||||
(errno-error val
|
(errno-msg val)
|
||||||
(errno-msg val)
|
%connect
|
||||||
%connect
|
sock
|
||||||
sock
|
name)))
|
||||||
name)))
|
(loop))))))))))))
|
||||||
(loop))))))))))))
|
|
||||||
|
|
||||||
(import-os-error-syscall %connect (sockfd family name) "scheme_connect")
|
(import-os-error-syscall %connect (sockfd family name) "scheme_connect")
|
||||||
|
|
||||||
|
|
|
@ -131,13 +131,9 @@ s48_value scheme_connect(s48_value sock, s48_value family, s48_value scheme_name
|
||||||
&& errno != EINPROGRESS && errno != EAGAIN)
|
&& errno != EINPROGRESS && errno != EAGAIN)
|
||||||
s48_raise_os_error_3(errno, sock, family, scheme_name);
|
s48_raise_os_error_3(errno, sock, family, scheme_name);
|
||||||
|
|
||||||
if (! (s48_add_pending_fd(sockfd, 0)))
|
return
|
||||||
s48_raise_out_of_memory_error();
|
s48_cons ((errno == EINPROGRESS) ? S48_TRUE : S48_FALSE,
|
||||||
|
s48_enter_fixnum (sockfd));
|
||||||
if (errno == EINPROGRESS)
|
|
||||||
return s48_enter_fixnum (0);
|
|
||||||
else return S48_FALSE;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
s48_raise_argument_type_error (family); /* error unknown address family */
|
s48_raise_argument_type_error (family); /* error unknown address family */
|
||||||
|
|
Loading…
Reference in New Issue