call select in connect only on EINPROGRESS, loop on other errors
(which should not happend anyway according to POSIX).
This commit is contained in:
parent
bcd64a2b3a
commit
8900f05fd2
scsh
|
@ -228,7 +228,7 @@
|
||||||
"connect: trying to connect socket to incompatible address ~s"
|
"connect: trying to connect socket to incompatible address ~s"
|
||||||
name))
|
name))
|
||||||
((and (= family address-family/unix)
|
((and (= family address-family/unix)
|
||||||
; save space for \0
|
; save space for \0
|
||||||
(> (string-length (socket-address:address name)) 107))
|
(> (string-length (socket-address:address name)) 107))
|
||||||
(error "connect: filename too long" name))
|
(error "connect: filename too long" name))
|
||||||
(else
|
(else
|
||||||
|
@ -239,9 +239,9 @@
|
||||||
(socket:family sock)
|
(socket:family sock)
|
||||||
(socket-address:address name))))
|
(socket-address:address name))))
|
||||||
(if (car error?.einprogress?)
|
(if (car error?.einprogress?)
|
||||||
(begin
|
(if (cdr error?.einprogress?)
|
||||||
(select '#() (vector (socket:outport sock)) '#())
|
(begin
|
||||||
(if (cdr error?.einprogress?)
|
(select '#() (vector (socket:outport sock)) '#())
|
||||||
;; 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
|
||||||
|
@ -252,8 +252,8 @@
|
||||||
(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")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue