port->socket now dups both ports. This is also documented.
This commit is contained in:
parent
e17a183ffe
commit
a3332290c6
|
@ -128,7 +128,11 @@ is preferred to explicitly closing the inport and outport because using
|
||||||
\begin{desc}
|
\begin{desc}
|
||||||
This procedure turns \var{port} into a socket object. The port's
|
This procedure turns \var{port} into a socket object. The port's
|
||||||
underlying file descriptor must be a socket with protocol family
|
underlying file descriptor must be a socket with protocol family
|
||||||
\var{protocol-family}. \ex{port->socket} comes in handy for writing
|
\var{protocol-family}. \ex{port->socket} applies \ex{dup->inport}
|
||||||
|
and \ex{dup->outport} to \var{port} to create the ports of the
|
||||||
|
socket object.
|
||||||
|
|
||||||
|
\ex{port->socket} comes in handy for writing
|
||||||
servers which run as children of \texttt{inetd}: after receiving a
|
servers which run as children of \texttt{inetd}: after receiving a
|
||||||
connection \texttt{inetd} creates a socket and passes it as
|
connection \texttt{inetd} creates a socket and passes it as
|
||||||
standard input to its child.
|
standard input to its child.
|
||||||
|
|
|
@ -172,12 +172,8 @@
|
||||||
port
|
port
|
||||||
(lambda (fd)
|
(lambda (fd)
|
||||||
(%getsockopt fd level/socket socket/debug)))
|
(%getsockopt fd level/socket socket/debug)))
|
||||||
(let ((in (if (input-port? port)
|
(let ((in (dup->inport port))
|
||||||
port
|
(out (dup->outport port)))
|
||||||
(dup->inport port)))
|
|
||||||
(out (if (output-port? port)
|
|
||||||
port
|
|
||||||
(dup->outport port))))
|
|
||||||
(make-socket pf in out)))
|
(make-socket pf in out)))
|
||||||
|
|
||||||
(import-os-error-syscall %socket (pf type protocol) "scsh_socket")
|
(import-os-error-syscall %socket (pf type protocol) "scsh_socket")
|
||||||
|
|
Loading…
Reference in New Issue