aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2015-02-27 13:43:12 -0800
committerfriendica <info@friendica.com>2015-02-27 13:43:12 -0800
commit2b44c5fc72ac1a76b0a711d459ddcb52ed6666dc (patch)
tree8ca0bd9d8f4e7cc43ed8f90ca90b23ed04ef7127 /include
parent2a74fab21a3e055a794ebef421eada79ca89c390 (diff)
downloadvolse-hubzilla-2b44c5fc72ac1a76b0a711d459ddcb52ed6666dc.tar.gz
volse-hubzilla-2b44c5fc72ac1a76b0a711d459ddcb52ed6666dc.tar.bz2
volse-hubzilla-2b44c5fc72ac1a76b0a711d459ddcb52ed6666dc.zip
Fix a couple of places where we weren't checking for dead hublocs. Add a function to mark a hubloc dead.
Diffstat (limited to 'include')
-rw-r--r--include/hubloc.php11
-rw-r--r--include/notifier.php19
2 files changed, 24 insertions, 6 deletions
diff --git a/include/hubloc.php b/include/hubloc.php
index b5a3d47c5..94f1dc985 100644
--- a/include/hubloc.php
+++ b/include/hubloc.php
@@ -170,7 +170,16 @@ function hubloc_change_primary($hubloc) {
return true;
}
-
+
+// We use the post url to distinguish between http and https hublocs.
+// The https might be alive, and the http dead.
+
+function hubloc_mark_as_down($posturl) {
+ $r = q("update hubloc set hubloc_status = ( hubloc_status | %d ) where hubloc_posturl = '%s'",
+ intval(HUBLOC_OFFLINE)
+ );
+}
+
function xchan_store($arr) {
diff --git a/include/notifier.php b/include/notifier.php
index 36a52b209..a9c4905ae 100644
--- a/include/notifier.php
+++ b/include/notifier.php
@@ -100,10 +100,14 @@ function notifier_run($argv, $argc){
// Get the recipient
$r = q("select abook.*, hubloc.* from abook
left join hubloc on hubloc_hash = abook_xchan
- where abook_id = %d and not ( abook_flags & %d )>0 limit 1",
+ where abook_id = %d and not ( abook_flags & %d ) > 0
+ and not (hubloc_flags & %d) > 0 and not (hubloc_status & %d) > 0 limit 1",
intval($item_id),
- intval(ABOOK_FLAG_SELF)
+ intval(ABOOK_FLAG_SELF),
+ intval(HUBLOC_FLAGS_DELETED),
+ intval(HUBLOC_OFFLINE)
);
+
if($r) {
// Get the sender
$s = q("select * from channel left join xchan on channel_hash = xchan_hash where channel_id = %d limit 1",
@@ -116,8 +120,11 @@ function notifier_run($argv, $argc){
}
else {
// send a refresh message to each hub they have registered here
- $h = q("select * from hubloc where hubloc_hash = '%s'",
- dbesc($r[0]['hubloc_hash'])
+ $h = q("select * from hubloc where hubloc_hash = '%s'
+ and not (hubloc_flags & %d) > 0 and not (hubloc_status & %d) > 0",
+ dbesc($r[0]['hubloc_hash']),
+ intval(HUBLOC_FLAGS_DELETED),
+ intval(HUBLOC_OFFLINE)
);
if($h) {
foreach($h as $hh) {
@@ -138,7 +145,6 @@ function notifier_run($argv, $argc){
}
}
}
-
return;
}
@@ -491,6 +497,9 @@ function notifier_run($argv, $argc){
logger('notifier: hub choice: ' . intval($relay_to_owner) . ' ' . intval($private) . ' ' . $cmd, LOGGER_DEBUG);
+ // FIXME: I think we need to remove the private bit or this clause will never execute. Needs more coffee to think it through.
+ // We may in fact have to send it to clones in case the one we pick recently died.
+
if($relay_to_owner && (! $private) && ($cmd !== 'relay')) {
// If sending a followup to the post owner, only send it to one channel clone - to avoid race conditions.