MCPcopy Create free account
hub / github.com/F-Stack/f-stack / anetSendTimeout

Function anetSendTimeout

app/redis-6.2.6/src/anet.c:201–211  ·  view source on GitHub ↗

Set the socket send timeout (SO_SNDTIMEO socket option) to the specified * number of milliseconds, or disable it if the 'ms' argument is zero. */

Source from the content-addressed store, hash-verified

199/* Set the socket send timeout (SO_SNDTIMEO socket option) to the specified
200 * number of milliseconds, or disable it if the 'ms' argument is zero. */
201int anetSendTimeout(char *err, int fd, long long ms) {
202 struct timeval tv;
203
204 tv.tv_sec = ms/1000;
205 tv.tv_usec = (ms%1000)*1000;
206 if (setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv)) == -1) {
207 anetSetError(err, "setsockopt SO_SNDTIMEO: %s", strerror(errno));
208 return ANET_ERR;
209 }
210 return ANET_OK;
211}
212
213/* Set the socket receive timeout (SO_RCVTIMEO socket option) to the specified
214 * number of milliseconds, or disable it if the 'ms' argument is zero. */

Callers 3

setBlockingTimeoutFunction · 0.85
unsetBlockingTimeoutFunction · 0.85
connSendTimeoutFunction · 0.85

Calls 2

anetSetErrorFunction · 0.85
setsockoptFunction · 0.70

Tested by

no test coverage detected