Skip to content

Commit b6ad1ea

Browse files
TELECOM-11880: rest socket change
1 parent 4494dd7 commit b6ad1ea

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

modules/rest_client/rest_methods.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1662,7 +1662,7 @@ int connect_only(preconnect_urls *precon_urls, int total_cons) {
16621662
start = start->next;
16631663
}
16641664

1665-
busy_wait = connect_poll_interval;
1665+
busy_wait = 100;
16661666

16671667
if (setsocket_callback(multi_handle) != 0) {
16681668
goto cleanup;
@@ -1686,11 +1686,11 @@ int connect_only(preconnect_urls *precon_urls, int total_cons) {
16861686

16871687
if (timer < 0) {
16881688
break;
1689-
}
1689+
}
16901690

16911691
usleep(1000UL * busy_wait);
16921692
LM_DBG("Creating warm pool connection, running handles %d\n", running_handles);
1693-
} while (running_handles != 0);
1693+
} while (running_sockets());
16941694

16951695
cleanup:
16961696
do {

modules/rest_client/rest_sockets.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,21 @@ int get_max_fd(int no_max_default) {
8181
return ((fds.max_fd_index << 3) + WORD_SIZE_BITS - 1) - COUNT_LEADING_ZEROS(sockets);
8282
}
8383

84+
int running_sockets(void) {
85+
cpuword_t sockets;
86+
int running, curl_fd;
87+
88+
for (int i = 0; i <= fds.max_fd_index; i += WORD_SIZE_BYTES) {
89+
memcpy(&sockets, fds.tracked_socks + i, sizeof(cpuword_t));
90+
91+
if (sockets) {
92+
return 1;
93+
}
94+
}
95+
96+
return 0;
97+
}
98+
8499
static void add_sock(int s) {
85100
int sock_index = s >> 3;
86101

modules/rest_client/rest_sockets.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
int init_process_limits(rlim_t rlim_cur);
3030
int get_max_fd(int no_max_default);
31+
int running_sockets(void);
3132
int start_multi_socket(CURLM *multi_handle);
3233
int run_multi_socket(CURLM *multi_handle);
3334
int setsocket_callback(CURLM *multi_handle);

0 commit comments

Comments
 (0)