aboutsummaryrefslogtreecommitdiff
path: root/lib/net/poll_linux.go
AgeCommit message (Collapse)Author
2025-01-23all: use for-range with numericShulhan
Go 1.22 now support for-range on numeric value.
2025-01-23lib/net: remove old build tagsShulhan
2024-03-05all: comply with linter recommendations #2Shulhan
HTTP request now implicitly create request with context. Any false positive related to not closing HTTP response body has been annotated with "nolint:bodyclose". In the example code, use consistent "// Output:" comment format, by prefixing with single space. Any comment on code now also prefixing with single space. An error returned without variables now use [errors.New] instead of [fmt.Errorf]. Any error returned using [fmt.Errorf] now wrapped using "%w" instead of "%s". Also, replace error checking using [errors.Is] or [errors.As], instead of using equal/not-equal operator. Any statement like "x = x OP y" now replaced with "x OP= y". Also, swap statement is simplified using "x, y = y, x". Any switch statement with single case now replaced with if-condition. Any call to defer on function or program that call [os.Exit], now replaced by calling the deferred function directly. Any if-else condition now replaced with switch statement, if possible.
2023-07-01lib/net: changes the WaitRead/Event model on PollShulhan
Previously, the Pool's WaitRead and WaitReadEVent methods return list of file descriptor (fd) and keeps the fd in the pool. In case we want to process the returned fd concurrently, by running it in different goroutine, the next call WaitRead may return the same fd if its goroutine not fast enought to read from fd. This changes fix this issue by removing list of fd from poll and set the fd flag to blocking mode again after returning it from WaitRead or WaitReadEvent. This changes also remove the ReregisterRead and ReregisterEvent methods since it is not applicable anymore.
2023-07-01lib/net: implement generic PollEventShulhan
The PollEvent contains file descriptor and the underlying event based on OS, unix.EpollEvent on Linux or unix.Kevent_t on BSD. The Poll interface provides two APIs to works with PollEvent, WaitReadEvents that return list of PollEvent ready for read, and ReregisterEvent to register the event back to poll (only for Linux).
2023-06-29lib/net: set the file descriptor to non-block on ReregisterReadShulhan
In case the user of poll changes the fd flags to block for reading or writing and forgot to set it non-block again, this may cause an issue on the poll.
2022-05-09all: reformat all codes using gofmt 1.19 (the Go tip)Shulhan
2020-06-10all: update email addressShulhan
2019-12-07net: check and log error on poll's UnregisterReadShulhan
2019-11-14net: handle interrupted system call on epoll WaitShulhan
2019-11-04net: fix the implementation of epollShulhan
While at it, add copyright information.
2019-11-01net: implement network polling using epoll and kqueueShulhan
This is the first implementation of (almost) generic polling. The Poll currently only support the Read events from now, because the most common use case is for handling multiple socket without using goroutines.