mirror of
https://github.com/postgres/postgres.git
synced 2025-12-19 17:02:53 +03:00
Add WL_SOCKET_CLOSED for socket shutdown events.
Provide a way for WaitEventSet to report that the remote peer has shut down its socket, independently of whether there is any buffered data remaining to be read. This works only on systems where the kernel exposes that information, namely: * WAIT_USE_POLL builds using POLLRDHUP, if available * WAIT_USE_EPOLL builds using EPOLLRDHUP * WAIT_USE_KQUEUE builds using EV_EOF Reviewed-by: Zhihong Yu <zyu@yugabyte.com> Reviewed-by: Maksim Milyutin <milyutinma@gmail.com> Discussion: https://postgr.es/m/77def86b27e41f0efcba411460e929ae%40postgrespro.ru
This commit is contained in:
@@ -134,10 +134,11 @@ typedef struct Latch
|
||||
/* avoid having to deal with case on platforms not requiring it */
|
||||
#define WL_SOCKET_CONNECTED WL_SOCKET_WRITEABLE
|
||||
#endif
|
||||
|
||||
#define WL_SOCKET_CLOSED (1 << 7)
|
||||
#define WL_SOCKET_MASK (WL_SOCKET_READABLE | \
|
||||
WL_SOCKET_WRITEABLE | \
|
||||
WL_SOCKET_CONNECTED)
|
||||
WL_SOCKET_CONNECTED | \
|
||||
WL_SOCKET_CLOSED)
|
||||
|
||||
typedef struct WaitEvent
|
||||
{
|
||||
@@ -180,5 +181,6 @@ extern int WaitLatchOrSocket(Latch *latch, int wakeEvents,
|
||||
pgsocket sock, long timeout, uint32 wait_event_info);
|
||||
extern void InitializeLatchWaitSet(void);
|
||||
extern int GetNumRegisteredWaitEvents(WaitEventSet *set);
|
||||
extern bool WaitEventSetCanReportClosed(void);
|
||||
|
||||
#endif /* LATCH_H */
|
||||
|
||||
Reference in New Issue
Block a user