From ea9ba58da58fc03e4b1ae1d6e277dad8189fa920 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sat, 19 Mar 2016 06:54:14 -0700 Subject: Size mode meaningful in datagram sockets. * socket.c (struct dgram_stream): new rx_max member. (make_dgram_sock_stream): New arguments: a struct stdio_mode, and pointer to prototype dgram socket. If a size is specified in the mode, then use that as rx_max. Otherwise if a prototype socket is specified, use its rx_max as the new socket's rx_max. Otherwise default on 65536. (dgram_get_byte_callback): Use d->rx_max as the capture size, rather than a hard-coded 65536. (sock_accept): Use d->rx_max as capture size for datagram. Parse the mode. Pass the parsed mode to make_dgram_sock_stream, as well as the accepting socket, so it can set up the rx_max for the new socket. (open_sockfd): Parse the mode and pass to make_dgram_sock_stream. * stream.c (parse_mode): Static function becomes extern. * stream.h (parse_mode): Declared. * txr.1: Documented. --- stream.h | 1 + 1 file changed, 1 insertion(+) (limited to 'stream.h') diff --git a/stream.h b/stream.h index f0c6433a..abb0bec0 100644 --- a/stream.h +++ b/stream.h @@ -126,6 +126,7 @@ void fill_stream_ops(struct strm_ops *ops); void stream_print_op(val stream, val out, val pretty); void stream_mark_op(val stream); void stream_destroy_op(val stream); +struct stdio_mode parse_mode(val mode_str); val normalize_mode(struct stdio_mode *m, val mode_str); val set_mode_props(const struct stdio_mode m, val stream); val generic_get_line(val stream); -- cgit v1.2.3