MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / redisCheckSocketError

Function redisCheckSocketError

deps/hiredis/net.c:294–314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

292}
293
294int redisCheckSocketError(redisContext *c) {
295 int err = 0, errno_saved = errno;
296 socklen_t errlen = sizeof(err);
297
298 if (getsockopt(c->fd, SOL_SOCKET, SO_ERROR, &err, &errlen) == -1) {
299 __redisSetErrorFromErrno(c,REDIS_ERR_IO,"getsockopt(SO_ERROR)");
300 return REDIS_ERR;
301 }
302
303 if (err == 0) {
304 err = errno_saved;
305 }
306
307 if (err) {
308 errno = err;
309 __redisSetErrorFromErrno(c,REDIS_ERR_IO,NULL);
310 return REDIS_ERR;
311 }
312
313 return REDIS_OK;
314}
315
316int redisContextSetTimeout(redisContext *c, const struct timeval tv) {
317 const void *to_ptr = &tv;

Callers 2

redisContextWaitReadyFunction · 0.85

Calls 1

__redisSetErrorFromErrnoFunction · 0.85

Tested by

no test coverage detected