[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 20/23: eports: nonblocking connect-eport
From: |
Andy Wingo |
Subject: |
[Guile-commits] 20/23: eports: nonblocking connect-eport |
Date: |
Thu, 24 Mar 2016 14:26:04 +0000 |
wingo pushed a commit to branch wip-ethreads
in repository guile.
commit 23b12b042d20b9f8bfeeccedad997528e9345b44
Author: Andy Wingo <address@hidden>
Date: Fri Mar 30 17:39:32 2012 +0200
eports: nonblocking connect-eport
* module/ice-9/eports.scm (connect-eport): Add implementation of
nonblocking `connect' for eports.
---
module/ice-9/eports.scm | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/module/ice-9/eports.scm b/module/ice-9/eports.scm
index c6300d3..f098e84 100644
--- a/module/ice-9/eports.scm
+++ b/module/ice-9/eports.scm
@@ -34,6 +34,7 @@
current-write-waiter
accept-eport
+ connect-eport
get-u8
putback-u8
@@ -178,6 +179,17 @@
(wait-for-readable eport)
(accept-eport eport)))))
+;; Connect a socket eport to the remote host at SOCKADDR. Returns no
+;; values.
+;;
+(define (connect-eport eport sockaddr)
+ (unless (nio-connect (eport-fd eport) sockaddr)
+ (wait-for-writable eport)
+ (let ((err (getsockopt (eport-fd eport) SOL_SOCKET SO_ERROR)))
+ (unless (zero? err)
+ (scm-error 'system-error "connect-eport" "~A"
+ (list (strerror err)) #f)))))
+
;; Ensure that there are readable bytes in the buffer, or that the
;; buffer is at EOF. Returns the actual number of available bytes.
;;
- [Guile-commits] 18/23: (web server ethreads) TCP_NODELAY tweak, (continued)
- [Guile-commits] 18/23: (web server ethreads) TCP_NODELAY tweak, Andy Wingo, 2016/03/24
- [Guile-commits] 05/23: http: allow custom read-line / continuation-line? functions, Andy Wingo, 2016/03/24
- [Guile-commits] 06/23: setsockopt can take an fd, Andy Wingo, 2016/03/24
- [Guile-commits] 10/23: EOF fix for continuation-line?, Andy Wingo, 2016/03/24
- [Guile-commits] 19/23: nio: add non-blocking connect, Andy Wingo, 2016/03/24
- [Guile-commits] 08/23: add #:limit to get-bytevector-delimited, Andy Wingo, 2016/03/24
- [Guile-commits] 11/23: socket: TCP_CORK, TCP_NODELAY, Andy Wingo, 2016/03/24
- [Guile-commits] 23/23: virtualize read/write/close operations in <eport>, Andy Wingo, 2016/03/24
- [Guile-commits] 15/23: (web server ethreads): more use of latin1 accessors, Andy Wingo, 2016/03/24
- [Guile-commits] 01/23: add (ice-9 nio), Andy Wingo, 2016/03/24
- [Guile-commits] 20/23: eports: nonblocking connect-eport,
Andy Wingo <=
- [Guile-commits] 14/23: refactoring to (web server ethreads) read-http-line, Andy Wingo, 2016/03/24
- [Guile-commits] 02/23: add (ice-9 eports), Andy Wingo, 2016/03/24
- [Guile-commits] 17/23: getsockopt: allow raw file descriptors, Andy Wingo, 2016/03/24
- [Guile-commits] 16/23: eports: add put-utf8-char, put-utf8-string, Andy Wingo, 2016/03/24
- [Guile-commits] 03/23: add (ice-9 epoll), Andy Wingo, 2016/03/24
- [Guile-commits] 21/23: eports tweak, Andy Wingo, 2016/03/24
- [Guile-commits] 07/23: add (web server ethreads), Andy Wingo, 2016/03/24
- [Guile-commits] 22/23: add examples/ethreads/memcached-{client, server}, Andy Wingo, 2016/03/24