aboutsummaryrefslogtreecommitdiffstats
path: root/include/zot.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2015-01-27 15:47:24 -0800
committerfriendica <info@friendica.com>2015-01-27 15:47:24 -0800
commit2f4ef7660c82f7b8878a7c2d14c9e69a52b8fbc0 (patch)
tree932e942c144586dd298bd641644d523a96abb479 /include/zot.php
parent525c62ab1d90ad7fed33267bc64cc85f0c4492f8 (diff)
downloadvolse-hubzilla-2f4ef7660c82f7b8878a7c2d14c9e69a52b8fbc0.tar.gz
volse-hubzilla-2f4ef7660c82f7b8878a7c2d14c9e69a52b8fbc0.tar.bz2
volse-hubzilla-2f4ef7660c82f7b8878a7c2d14c9e69a52b8fbc0.zip
improved route mismatch detection. We will be less strict about the absolute route matching and only look at the last hop before it got to us - which is ultimately all we should care about (since that sender controls the thread permissions). Route mismatches seem to occur somewhat frequently from yamkote (for unknown reasons), and the logging has been improved a bit so it should provide some slightly more useful debugging info in case it still happens going forward. Oh, also we'll set the parent on comments when we store the initial post (item_store()) and only go back and set the parent for top-level posts. This should reduce the number of comments with missing parents on shared hosts, but may increase the number of missing threads. Probably worthwhile to do a query occasionally for parent = 0 and see how we're doing and how many have shared host related delivery issues.
Diffstat (limited to 'include/zot.php')
-rw-r--r--include/zot.php24
1 files changed, 22 insertions, 2 deletions
diff --git a/include/zot.php b/include/zot.php
index bedc0c1b5..2fcada429 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -1522,14 +1522,34 @@ function process_delivery($sender,$arr,$deliveries,$relay,$public = false,$reque
// going downstream check that we have the same upstream provider that
// sent it to us originally. Ignore it if it came from another source
- // (with potentially different permissions)
+ // (with potentially different permissions).
+ // only compare the last hop since it could have arrived at the last location any number of ways.
+ // Always accept empty routes.
+
+ $existing_route = explode(',', $r[0]['route']);
+ $routes = count($existing_route);
+ if($routes) {
+ $last_hop = array_pop($existing_route);
+ $last_prior_route = implode(',',$existing_route);
+ }
+ else {
+ $last_hop = '';
+ $last_prior_route = '';
+ }
$current_route = (($arr['route']) ? $arr['route'] . ',' : '') . $sender['hash'];
- if($r[0]['route'] != $current_route) {
+ if($last_hop && $last_hop != $sender['hash']) {
+ logger('comment route mismatch: parent route = ' . $r[0]['route'] . ' expected = ' . $current_route, LOGGER_DEBUG);
+ logger('comment route mismatch: parent msg = ' . $r[0]['id'],LOGGER_DEBUG);
$result[] = array($d['hash'],'comment route mismatch',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>',$arr['mid']);
continue;
}
+
+ // we'll add sender['hash'] onto this when we deliver it. $last_prior_route now has the previously stored route
+ // *except* for the sender['hash'] which would've been the last hop before it got to us.
+
+ $arr['route'] = $last_prior_route;
}
}