library/src/blockclass/BP-BlockClass.cc
// Attempt to validate all proxies in the current proxy set.  This action will modify data items within
// the current proxy sets to reflect validation status (aka it will toggle enabled/disabled fields).
Attempt to validate all proxies in the current proxy set.  This action will modify data items within
the current proxy sets to reflect validation status (aka it will toggle enabled/disabled fields).
Attempt to validate all proxies in the current proxy set . This action will modify data items within the current proxy sets to reflect validation status ( aka it will toggle enabled / disabled fields ) .
BP_ERROR_T Block::validateProxyDBEntries(size_t tests_to_try_before_failure_n, bool brute_force_proxy_type, bool use_threads, size_t thread_n, size_t timeout_in_seconds)
{
	if(!this->mysqlSession)
		return ERR_FAILURE;
	BP_BLOCK_MARIADB_ENTER_CRITICAL_SECTION;
	if(!tests_to_try_before_failure_n)
		return ERR_FAILURE;
	void ** params = (void **) tq_calloc(this->tq, (this->db_populated_proxy_n+1) * (sizeof(void*)), 1, BPLN);
	size_t n = 0;
	for(; n < this->db_populated_proxy_n; n++)
	{
		P_BP_DB_VALIDATION_THREAD_PARMS thread_parm_item = (P_BP_DB_VALIDATION_THREAD_PARMS) tq_calloc(this->tq, sizeof(BP_DB_VALIDATION_THREAD_PARMS), 1, BPLN);
		thread_parm_item->proxy_entry = (P_BP_PROXY_DB_ENTRY) &this->db_populated_proxy_sets[n];
		thread_parm_item->test_entries = (P_BP_PROXY_DB_VALIDATION_TEST_ENTRY) this->db_populated_proxy_validation_tests;
		thread_parm_item->test_entry_n = this->db_populated_proxy_validation_test_n;
		thread_parm_item->test_attempt_before_failing_validation = tests_to_try_before_failure_n;
		thread_parm_item->brute_force_proxy_type = brute_force_proxy_type;
		thread_parm_item->timeout = timeout_in_seconds;
		params[n] = (void *) thread_parm_item;
	}
	this->threadedDataProcessor(thread_n, BP_HTTPValidateProxyTypeByBruteForce_thinit, params, n);
	BP_BLOCK_MARIADB_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC(ERR_SUCCESS);
}
BP_ERROR_T Block :: validateProxyDBEntries ( size_t tests_to_try_before_failure_n , bool brute_force_proxy_type , bool use_threads , size_t thread_n , size_t timeout_in_seconds ) { if ( ! this -> mysqlSession ) return ERR_FAILURE ; BP_BLOCK_MARIADB_ENTER_CRITICAL_SECTION ; if ( ! tests_to_try_before_failure_n ) return ERR_FAILURE ; void * * params = ( void * * ) tq_calloc ( this -> tq , ( this -> db_populated_proxy_n + 1 ) * ( sizeof ( void * ) ) , 1 , BPLN ) ; size_t n = 0 ; for ( ; n < this -> db_populated_proxy_n ; n ++ ) { P_BP_DB_VALIDATION_THREAD_PARMS thread_parm_item = ( P_BP_DB_VALIDATION_THREAD_PARMS ) tq_calloc ( this -> tq , sizeof ( BP_DB_VALIDATION_THREAD_PARMS ) , 1 , BPLN ) ; thread_parm_item -> proxy_entry = ( P_BP_PROXY_DB_ENTRY ) & this -> db_populated_proxy_sets [ n ] ; thread_parm_item -> test_entries = ( P_BP_PROXY_DB_VALIDATION_TEST_ENTRY ) this -> db_populated_proxy_validation_tests ; thread_parm_item -> test_entry_n = this -> db_populated_proxy_validation_test_n ; thread_parm_item -> test_attempt_before_failing_validation = tests_to_try_before_failure_n ; thread_parm_item -> brute_force_proxy_type = brute_force_proxy_type ; thread_parm_item -> timeout = timeout_in_seconds ; params [ n ] = ( void * ) thread_parm_item ; } this -> threadedDataProcessor ( thread_n , BP_HTTPValidateProxyTypeByBruteForce_thinit , params , n ) ; BP_BLOCK_MARIADB_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC ( ERR_SUCCESS ) ; }
Attempt to validate all proxies in the current proxy set.
Attempt to validate all proxies in the current proxy set .
// exit if the mysqli object is unset // enter critical section // ensure we have a number of tests to test with // allocate space for parameters // loop through proxies and set pointers in parameter stack // allocate parameter structure (this is tq_free(this->tq, )d from inside the thread.  No need to worry about cleanup of // this particular structure.  This tq_free(this->tq, ) scheme isn't specific to the thread processor method below, but rather simply specific // to this routine. // set proxy entry to test (since this routine is blocking with pthread_join(), it's fine to leave mutable // data here (i think, whiskey, mrrrrggh). // set test entries // set the max number of tests to try before failure // set flag inidicating whether or not to brute force a proxy type // set timeout (in seconds) // -- // set parameter in dispatcher item stack (this data will be processed iteratively in a threaded environment) // run the threaded data processor to evaluate the proxies individually // return indicating success