[FIX] Use existing memcache instance for AntiDOS

This commit is contained in:
Sebastian Grewe 2014-04-28 11:05:06 +02:00
parent 1d6a560dd7
commit 23eed77ebe
2 changed files with 2 additions and 7 deletions

View File

@ -17,6 +17,7 @@ require_once(INCLUDE_DIR . '/config/error_codes.inc.php');
require_once(CLASS_DIR . '/base.class.php');
require_once(CLASS_DIR . '/coins/coin_base.class.php');
require_once(CLASS_DIR . '/setting.class.php');
if (PHP_OS == 'WINNT') require_once(CLASS_DIR . '/memcached.class.php');
// Now decide on which coin class to load and instantiate
if (file_exists(CLASS_DIR . '/coins/coin_' . $config['algorithm'] . '.class.php')) {

View File

@ -43,14 +43,8 @@ include_once('include/bootstrap.php');
$hts = ($config['https_only'] && (!empty($_SERVER['QUERY_STRING']))) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME']."?".$_SERVER['QUERY_STRING'] : "https://".$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME'];
($config['https_only'] && @!$_SERVER['HTTPS']) ? exit(header("Location: ".$hts)):0;
// Rate limiting
// Rate limiting, we use our initilized memcache from bootstrap/autoloader
if ($config['memcache']['enabled'] && $config['mc_antidos']['enabled']) {
if (PHP_OS == 'WINNT') {
require_once(CLASS_DIR . '/memcached.class.php');
}
// memcache antidos needs a memcache handle
$memcache = new Memcached();
$memcache->addServer($config['memcache']['host'], $config['memcache']['port']);
require_once(CLASS_DIR . '/memcache_ad.class.php');
$skip_check = false;
// if this is an api call we need to be careful not to time them out for those calls separately