瀏覽代碼

Add 10ms delay after reloading Tor

Miraty 2 年之前
父節點
當前提交
bf4eedbe71
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      pg-act/ht/add-onion.php

+ 3 - 1
pg-act/ht/add-onion.php

@@ -19,7 +19,9 @@ exec(CONF['ht']['sudo_path'] . ' ' . CONF['ht']['tor_reload_cmd'], result_code:
 if ($code !== 0)
 if ($code !== 0)
 	output(500, 'Failed to reload Tor.');
 	output(500, 'Failed to reload Tor.');
 
 
-// Get the address generated by Tor
+usleep(10000);
+
+// Get the hostname generated by Tor
 $onion = exec(CONF['ht']['sudo_path'] . ' -u ' . CONF['ht']['tor_user'] . ' ' . CONF['ht']['cat_path'] . ' ' . CONF['ht']['tor_keys_path'] . '/' . $_SESSION['id'] . '/' . $_POST['dir'] . '/hostname');
 $onion = exec(CONF['ht']['sudo_path'] . ' -u ' . CONF['ht']['tor_user'] . ' ' . CONF['ht']['cat_path'] . ' ' . CONF['ht']['tor_keys_path'] . '/' . $_SESSION['id'] . '/' . $_POST['dir'] . '/hostname');
 if (preg_match('/^[0-9a-z]{56}\.onion$/D', $onion) !== 1)
 if (preg_match('/^[0-9a-z]{56}\.onion$/D', $onion) !== 1)
 	output(500, 'No onion address found.');
 	output(500, 'No onion address found.');