From 6f4ce69fc86b9272472ae356f8fa98eca7833c88 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sat, 27 Feb 2016 18:40:58 -0800 Subject: Socket streams know their connected peer address. * stream.c (struct stdio_handle): New member, peer. (stdio_stream_mark): Mark the new member. (sock_peer, sock_set_peer): New functions. (stream_init): Registered sock-peer intrinsic. * stream.h (sock_peer, sock_set_peer): Declared. * socket.c (sock_connect): If the connect is successful, then store the address into the stream as the peer. --- stream.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'stream.h') diff --git a/stream.h b/stream.h index 28d7ea70..148e6950 100644 --- a/stream.h +++ b/stream.h @@ -117,6 +117,8 @@ val stream_fd(val stream); #if HAVE_SOCKETS val sock_family(val stream); val sock_type(val stream); +val sock_peer(val stream); +val sock_set_peer(val stream, val peer); #endif val make_string_input_stream(val); val make_string_byte_input_stream(val); -- cgit v1.2.3