OStatus: be a little laxer about attempts to start/stop PuSH subscriptions that were left in an inconsistent state.

Instead of aborting, we'll try to reconfirm the sub/unsub, which once confirmed will replace whatever the previous state was on the server side.
This commit is contained in:
Brion Vibber
2010-03-19 15:47:43 -07:00
parent 79ec565104
commit c84c4c6839
2 changed files with 13 additions and 14 deletions

View File

@@ -61,7 +61,7 @@ class FeedSub extends Memcached_DataObject
public $__table = 'feedsub';
public $id;
public $feeduri;
public $uri;
// PuSH subscription data
public $huburi;
@@ -238,7 +238,7 @@ class FeedSub extends Memcached_DataObject
public function subscribe($mode='subscribe')
{
if ($this->sub_state && $this->sub_state != 'inactive') {
throw new ServerException("Attempting to start PuSH subscription to feed in state $this->sub_state");
common_log(LOG_WARNING, "Attempting to (re)start PuSH subscription to $this->uri in unexpected state $this->sub_state");
}
if (empty($this->huburi)) {
if (common_config('feedsub', 'nohub')) {
@@ -261,7 +261,7 @@ class FeedSub extends Memcached_DataObject
*/
public function unsubscribe() {
if ($this->sub_state != 'active') {
throw new ServerException("Attempting to end PuSH subscription to feed in state $this->sub_state");
common_log(LOG_WARNING, "Attempting to (re)end PuSH subscription to $this->uri in unexpected state $this->sub_state");
}
if (empty($this->huburi)) {
if (common_config('feedsub', 'nohub')) {