+ /* Find out own index in the array */
+ self = pthread_self ();
+ for (i = 0; i < connection_threads_num; i++)
+ if (pthread_equal (connection_threads[i], self) != 0)
+ break;
+ assert (i < connection_threads_num);
+
+ /* Move the trailing threads forward. */
+ if (i < (connection_threads_num - 1))
+ {
+ memmove (connection_threads + i,
+ connection_threads + i + 1,
+ sizeof (pthread_t) * (connection_threads_num - i - 1));
+ }
+
+ connection_threads_num--;
+
+ temp = realloc(connection_threads,
+ sizeof(*connection_threads) * connection_threads_num);
+ if (connection_threads_num > 0 && temp == NULL)
+ RRDD_LOG(LOG_ERR, "connection_thread_main: realloc(--) failed.");
+ else
+ connection_threads = temp;
+ }