[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#50849: 28.0.50; Proposal for Emacs daemon to signal when being busy
From: |
Lars Ingebrigtsen |
Subject: |
bug#50849: 28.0.50; Proposal for Emacs daemon to signal when being busy |
Date: |
Fri, 02 Sep 2022 14:28:18 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
Eli Zaretskii <eliz@gnu.org> writes:
> Looks like it doesn't by default, but we can ask it to do so. See,
> for example,
> https://stackoverflow.com/questions/30395258/setting-timeout-to-recv-function.
For posterity (in case Stackoverflow goes away before somebody gets
around to fixing this 🫠), the suggested solution is to do a setsockopt
with a RCVTIMEO. Which seems reasonable.
What would be a reasonable timeout here? Say... five seconds?
---
On Windows, the code would look like this:
DWORD timeout = SOCKET_READ_TIMEOUT_SEC * 1000;
setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, (char*)&timeout, sizeof(timeout));
//...
recv_size = recv(s, rx_tmp, bufSize, 0);
if (recv_size == SOCKET_ERROR)
{
if (WSAGetLastError() != WSAETIMEDOUT)
//...
}
On other platforms, the code would look like this instead:
struct timeval timeout;
timeout.tv_sec = SOCKET_READ_TIMEOUT_SEC;
timeout.tv_usec = 0;
setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(timeout));
//...
recv_size = recv(s, rx_tmp, bufSize, 0);
if (recv_size == -1)
{
if ((errno != EAGAIN) && (errno != EWOULDBLOCK))
//...
}
- bug#50849: 28.0.50; Proposal for Emacs daemon to signal when being busy, Lars Ingebrigtsen, 2022/09/02
- bug#50849: 28.0.50; Proposal for Emacs daemon to signal when being busy, Eli Zaretskii, 2022/09/02
- bug#50849: 28.0.50; Proposal for Emacs daemon to signal when being busy,
Lars Ingebrigtsen <=
- bug#50849: 28.0.50; Proposal for Emacs daemon to signal when being busy, Eli Zaretskii, 2022/09/02
- bug#50849: 28.0.50; Proposal for Emacs daemon to signal when being busy, Robert Pluim, 2022/09/02
- bug#50849: 28.0.50; Proposal for Emacs daemon to signal when being busy, Lars Ingebrigtsen, 2022/09/02
- bug#50849: 28.0.50; Proposal for Emacs daemon to signal when being busy, Visuwesh, 2022/09/02
- bug#50849: 28.0.50; Proposal for Emacs daemon to signal when being busy, Eli Zaretskii, 2022/09/02
- bug#50849: 28.0.50; Proposal for Emacs daemon to signal when being busy, Lars Ingebrigtsen, 2022/09/03
- bug#50849: 28.0.50; Proposal for Emacs daemon to signal when being busy, Stefan Kangas, 2022/09/03
- bug#50849: 28.0.50; Proposal for Emacs daemon to signal when being busy, Eli Zaretskii, 2022/09/03
- bug#50849: 28.0.50; Proposal for Emacs daemon to signal when being busy, Lars Ingebrigtsen, 2022/09/04
- bug#50849: 28.0.50; Proposal for Emacs daemon to signal when being busy, Stefan Kangas, 2022/09/05