From: Christopher Baines <mail@cbaines.net>
To: Maxime Devos <maximedevos@telenet.be>
Cc: guile-devel@gnu.org
Subject: Re: [PATCH] Define SO_RCVTIMEO and SO_SNDTIMEO.
Date: Sun, 18 Sep 2022 16:11:23 +0200 [thread overview]
Message-ID: <87leqgrcsc.fsf@cbaines.net> (raw)
In-Reply-To: <a0571903-1089-e99c-bcc5-fcf002a925d7@telenet.be>
[-- Attachment #1: Type: text/plain, Size: 1825 bytes --]
Thanks for the feedback Maxime, I obviously lost track of some things
after letting this patch languish for a while.
Maxime Devos <maximedevos@telenet.be> writes:
> On 17-09-2022 10:05, Christopher Baines wrote:
>> + if (ioptname == SO_RCVTIMEO || ioptname == SO_SNDTIMEO)
>> + {
>> + SCM_ASSERT (scm_is_pair (value), value, SCM_ARG4, FUNC_NAME);
>
> How about using SCM_ASSERT_TYPE instead to improve the error message a
> little?
I've switched to using SCM_ASSERT_TYPE now.
>> + opt_time.tv_sec = scm_to_ulong (SCM_CAR (value));
>> + opt_time.tv_usec = scm_to_ulong (SCM_CDR (value));
> I think it needs to be documented how to actually use SO_RCVTIMEO /
> SO_SNDTIMEO (more specifically, the types). For example, the user
> might expect to enter flonums 1.567 as time durations (in seconds)
> instead, or a duration from SRFI 19. How is the user supposed to know
> the appropriate type, aside from experimenting and reading the source
> code?
>
> Also, it is not documented there is a maximum on the number of
> seconds, I recommend to document that there is some limit, or
> alternatively clip numbers to the maximum.
I've added some documentation now, I'm not sure the interface is
perfect, but it should work.
>> + optlen = sizeof (opt_time);
>> + optval = &opt_time;
>> + }
>> +
>
> I think this needs a #if defined(SO_RCVTIMEO) && defined(SO_SNDTIMEO),
> for systems that don't have those. Alternatively, if all systems have
> those, it seems to me that the #ifdef in
I guess it should be conditional, so I've added the if in to getsockopt
and setsockopt.
>> +#ifdef SO_RCVTIMEO
>> + scm_c_define ("SO_RCVTIMEO", scm_from_int (SO_RCVTIMEO));
>> +#endif
>> +#ifdef SO_SNDTIMEO
>> + scm_c_define ("SO_SNDTIMEO", scm_from_int (SO_SNDTIMEO));
>> +#endif
>
> can be removed.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 987 bytes --]
next prev parent reply other threads:[~2022-09-18 14:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-17 8:05 [PATCH] Define SO_RCVTIMEO and SO_SNDTIMEO Christopher Baines
2022-09-17 9:40 ` Maxime Devos
2022-09-18 14:11 ` Christopher Baines [this message]
2022-09-18 13:56 ` [PATCH v2] " Christopher Baines
2022-09-18 14:17 ` [PATCH v3] " Christopher Baines
2022-10-12 20:28 ` Ludovic Courtès
2022-10-13 10:28 ` Christopher Baines
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87leqgrcsc.fsf@cbaines.net \
--to=mail@cbaines.net \
--cc=guile-devel@gnu.org \
--cc=maximedevos@telenet.be \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).