Commit graph

9 commits

Author SHA1 Message Date
Felix Fietkau
ef5e8e38bd usock: fix poll return code check
errno needs to be compared against EINTR/EAGAIN instead of the return code,
and only if the return code is < 0.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-03-08 09:38:55 +01:00
Felix Fietkau
0c2fbbca80 usock: implement usock_inet_timeout() with RFC6555 support
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2016-01-28 12:07:25 +01:00
Felix Fietkau
f8b32f7620 usock: add usock_inet, which returns the remote address
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2016-01-15 21:04:16 +01:00
Rafał Miłecki
f1c794b29e usock: set socket flags right after creating it
Otherwise some flags like USOCK_NONBLOCK wouldn't work as expected
(O_NONBLOCK affects connect behavior).

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
2015-01-15 13:10:58 +01:00
Rafał Miłecki
ad9b5a387d usock: add helper waiting for socket to be ready
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
2015-01-15 13:10:49 +01:00
Jo-Philipp Wich
fa73496098 usock: add usock_port() for convenient use of numeric ports
Add a new helper function usock_port() which converts the given numeric port number
into a string using a private static buffer. This way a calling application can
conveniently use numeric port arguments without having to convert them before:

  int fd = usock(USOCK_UDP, "example.org", usock_port(80));

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2014-09-23 12:01:00 +02:00
Felix Fietkau
f5245f9887 add license headers for usock
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-01-13 15:27:38 +01:00
Felix Fietkau
07dbea0058 usock: remove code duplication 2011-02-07 17:38:05 +01:00
Felix Fietkau
e82d74f898 Initial import 2010-10-13 21:29:08 +02:00