MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / sockets_pool_init

Function sockets_pool_init

modules/sockets_mgm/sockets_mgm.c:1176–1199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1174}
1175
1176static int sockets_pool_init(void)
1177{
1178 int len;
1179
1180 sockets_info = pkg_malloc(sock_mgm_max_sockets * sizeof *sockets_info);
1181 if (!sockets_info) {
1182 LM_ERR("oom for sockets info\n");
1183 return -1;
1184 }
1185 memset(sockets_info, 0, sock_mgm_max_sockets * sizeof *sockets_info);
1186
1187 len = (sizeof *sockets_pool)+
1188 (sock_mgm_max_sockets * sizeof *sockets_pool->used);
1189 sockets_pool = shm_malloc(len);
1190 if (!sockets_pool) {
1191 LM_ERR("oom for sockets pool\n");
1192 return -1;
1193 }
1194 memset(sockets_pool, 0, len);
1195 INIT_LIST_HEAD(&sockets_pool->running);
1196 sockets_pool->last_index = sock_mgm_max_sockets;
1197 sockets_pool->used = (char *)(sockets_pool + 1);
1198 return 0;
1199}
1200
1201static int sock_mgm_procs_func(modparam_t type, void *val)
1202{

Callers 1

mod_initFunction · 0.85

Calls 2

shm_mallocFunction · 0.85
INIT_LIST_HEADFunction · 0.85

Tested by

no test coverage detected