free and unset DB_DataObjects after we're done with them

darcs-hash:20080906015501-84dde-e787962b9805759224389dd42a211dfa21da3473.gz
This commit is contained in:
Evan Prodromou 2008-09-05 21:55:01 -04:00
parent 9e8ae6a1e7
commit 0c71340c9f
5 changed files with 34 additions and 0 deletions

View File

@ -92,6 +92,7 @@ function jabber_send_notice($to, $notice) {
$msg = jabber_format_notice($profile, $notice);
$entry = jabber_format_entry($profile, $notice);
$conn->message($to, $msg, 'chat', NULL, $entry);
$profile->free();
return true;
}
@ -204,6 +205,9 @@ function jabber_broadcast_notice($notice) {
$msg = jabber_format_notice($profile, $notice);
$entry = jabber_format_entry($profile, $notice);
$profile->free();
unset($profile);
$sent_to = array();
$conn = jabber_connect();
@ -225,6 +229,8 @@ function jabber_broadcast_notice($notice) {
$sent_to[$user->id] = 1;
}
$user->free();
# Now, get users subscribed to this profile
$user = new User();
@ -245,6 +251,8 @@ function jabber_broadcast_notice($notice) {
}
}
$user->free();
return true;
}
@ -280,6 +288,7 @@ function jabber_public_notice($notice) {
$conn->message($address, $msg, 'chat', NULL, $entry);
$conn->processTime(0);
}
$profile->free();
}
return true;

View File

@ -132,6 +132,9 @@ function omb_broadcast_remote_subscribers($notice) {
}
}
$rp->free();
unset($rp);
return true;
}
@ -160,6 +163,9 @@ function omb_post_notice_keys($notice, $postnoticeurl, $tk, $secret) {
$notice->id)));
$req->set_parameter('omb_notice_license', common_config('license', 'url'));
$user->free();
unset($user);
$req->sign_request(omb_hmac_sha1(), $con, $token);
# We re-use this tool's fetcher, since it's pretty good

View File

@ -87,11 +87,15 @@ class QueueHandler extends Daemon {
continue;
}
$this->log(LOG_INFO, 'finished broadcasting notice ID = ' . $notice->id);
$notice->free();
unset($notice);
$notice = NULL;
} else {
$this->log(LOG_WARNING, 'queue item for notice that does not exist');
}
$qi->delete();
$qi->free();
unset($qi);
$this->idle(0);
} else {
$this->clear_old_claims();
@ -115,6 +119,8 @@ class QueueHandler extends Daemon {
$qi->transport = $this->transport();
$qi->whereAdd('now() - claimed > '.CLAIM_TIMEOUT);
$qi->update(DB_DATAOBJECT_WHEREADD_ONLY);
$qi->free();
unset($qi);
}
function log($level, $msg) {

View File

@ -76,6 +76,10 @@ class XmppConfirmHandler extends XmppQueueHandler {
continue;
}
}
$user->free();
unset($user);
$confirm->free();
unset($confirm);
$this->idle(0);
} else {
# $this->clear_old_confirm_claims();
@ -119,6 +123,8 @@ class XmppConfirmHandler extends XmppQueueHandler {
$confirm->claimed = NULL;
$confirm->whereAdd('now() - claimed > '.CLAIM_TIMEOUT);
$confirm->update(DB_DATAOBJECT_WHEREADD_ONLY);
$confirm->free();
unset($confirm);
}
}

View File

@ -145,6 +145,9 @@ class XMPPDaemon extends Daemon {
}
$this->add_notice($user, $pl);
}
$user->free();
unset($user);
}
function is_self($from) {
@ -281,6 +284,8 @@ class XMPPDaemon extends Daemon {
common_broadcast_notice($notice);
$this->log(LOG_INFO,
'Added notice ' . $notice->id . ' from user ' . $user->nickname);
$notice->free();
unset($notice);
}
function handle_presence(&$pl) {
@ -310,6 +315,8 @@ class XMPPDaemon extends Daemon {
' status from presence.');
$this->add_notice($user, $pl);
}
$user->free();
unset($user);
}
break;
}