| 1619 | } |
| 1620 | |
| 1621 | int init_b2b_htables(void) |
| 1622 | { |
| 1623 | int i; |
| 1624 | |
| 1625 | server_htable = (b2b_table)shm_malloc(server_hsize* sizeof(b2b_entry_t)); |
| 1626 | client_htable = (b2b_table)shm_malloc(client_hsize* sizeof(b2b_entry_t)); |
| 1627 | if(!server_htable || !client_htable) |
| 1628 | ERR_MEM(SHARE_MEM); |
| 1629 | |
| 1630 | memset(server_htable, 0, server_hsize* sizeof(b2b_entry_t)); |
| 1631 | memset(client_htable, 0, client_hsize* sizeof(b2b_entry_t)); |
| 1632 | for(i= 0; i< server_hsize; i++) |
| 1633 | { |
| 1634 | lock_init(&server_htable[i].lock); |
| 1635 | } |
| 1636 | |
| 1637 | for(i= 0; i< client_hsize; i++) |
| 1638 | { |
| 1639 | lock_init(&client_htable[i].lock); |
| 1640 | } |
| 1641 | |
| 1642 | return 0; |
| 1643 | |
| 1644 | error: |
| 1645 | return -1; |
| 1646 | } |
| 1647 | |
| 1648 | void destroy_b2b_htables(void) |
| 1649 | { |
no test coverage detected