MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / sockpool_get_from_pool

Function sockpool_get_from_pool

cdb2api/cdb2api.c:1886–1898  ·  view source on GitHub ↗

The sockpool mutex must be locked at this point */

Source from the content-addressed store, hash-verified

1884
1885/* The sockpool mutex must be locked at this point */
1886static int sockpool_get_from_pool(void)
1887{
1888 int fd = -1;
1889 for (int i = 0; i < sockpool_fd_count; i++) {
1890 struct sockpool_fd_list *sp = &sockpool_fds[i];
1891 if (sp->in_use == 0 && sp->sockpool_fd > -1) {
1892 fd = sp->sockpool_fd;
1893 sp->in_use = 1;
1894 break;
1895 }
1896 }
1897 return fd;
1898}
1899
1900/* The sockpool mutex must be locked at this point */
1901static int sockpool_place_fd_in_pool(int fd)

Callers 2

cdb2_socket_pool_get_llFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected