Skip to content

Commit aa28e2d

Browse files
committed
Merge pull request #2153 from MPOS/fix-memcache-usage
[FIX] Use existing memcache instance for AntiDOS
2 parents 1d6a560 + 23eed77 commit aa28e2d

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

public/include/autoloader.inc.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
require_once(CLASS_DIR . '/base.class.php');
1818
require_once(CLASS_DIR . '/coins/coin_base.class.php');
1919
require_once(CLASS_DIR . '/setting.class.php');
20+
if (PHP_OS == 'WINNT') require_once(CLASS_DIR . '/memcached.class.php');
2021

2122
// Now decide on which coin class to load and instantiate
2223
if (file_exists(CLASS_DIR . '/coins/coin_' . $config['algorithm'] . '.class.php')) {

public/index.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,8 @@ function cfip() { return (@defined('SECURITY')) ? 1 : 0; }
4343
$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'];
4444
($config['https_only'] && @!$_SERVER['HTTPS']) ? exit(header("Location: ".$hts)):0;
4545

46-
// Rate limiting
46+
// Rate limiting, we use our initilized memcache from bootstrap/autoloader
4747
if ($config['memcache']['enabled'] && $config['mc_antidos']['enabled']) {
48-
if (PHP_OS == 'WINNT') {
49-
require_once(CLASS_DIR . '/memcached.class.php');
50-
}
51-
// memcache antidos needs a memcache handle
52-
$memcache = new Memcached();
53-
$memcache->addServer($config['memcache']['host'], $config['memcache']['port']);
5448
require_once(CLASS_DIR . '/memcache_ad.class.php');
5549
$skip_check = false;
5650
// if this is an api call we need to be careful not to time them out for those calls separately

0 commit comments

Comments
 (0)