Fix a couple of places where we weren't checking for dead hublocs. Add a function to mark a hubloc dead.

This commit is contained in:
friendica 2015-02-27 13:43:12 -08:00
parent 2a74fab21a
commit 2b44c5fc72
4 changed files with 2923 additions and 2881 deletions

View File

@ -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) {

View File

@ -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.

File diff suppressed because it is too large Load Diff

View File

@ -1 +1 @@
2015-02-26.955
2015-02-27.956