1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-18 12:52:42 +01:00

Move subscription updates to the register function.

Summary: Currently, the `AphlictClient` will only send its subscriptions to the `AphlictMaster` once. If the original `AphlictMaster` is closed and a new master is created, then client subscriptions will be lost.

Test Plan: Opened two separate tabs. Closed the "master" tab and noticed that the subscriptions were re-sent to the server.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9487
This commit is contained in:
Joshua Spence 2014-06-11 14:08:58 -07:00 committed by epriestley
parent 4bc561f17b
commit aa534c69f0
3 changed files with 21 additions and 8 deletions

View file

@ -477,7 +477,7 @@ return array(
'rsrc/js/phuix/PHUIXActionListView.js' => 'b5c256b8',
'rsrc/js/phuix/PHUIXActionView.js' => '6e8cefa4',
'rsrc/js/phuix/PHUIXDropdownMenu.js' => 'bd4c8dca',
'rsrc/swf/aphlict.swf' => 'd9bca85d',
'rsrc/swf/aphlict.swf' => '2dea6ddc',
),
'symbols' =>
array(

View file

@ -31,6 +31,7 @@ package {
private var remoteServer:String;
private var remotePort:Number;
private var subscriptions:Array;
public function AphlictClient() {
@ -51,8 +52,9 @@ package {
this.externalInvoke('connect');
this.remoteServer = server;
this.remotePort = port;
this.remoteServer = server;
this.remotePort = port;
this.subscriptions = subscriptions;
this.client = AphlictClient.generateClientId();
this.recv.connect(this.client);
@ -61,10 +63,6 @@ package {
this.timer.addEventListener(TimerEvent.TIMER, this.keepalive);
this.connectToMaster();
// Send subscriptions to master.
this.log('Sending subscriptions to master.');
this.send.send('aphlict_master', 'subscribe', this.client, subscriptions);
}
/**
@ -95,11 +93,26 @@ package {
this.error(err);
}
this.registerWithMaster();
this.timer.start();
}
/**
* Register our client ID with the @{class:AphlictMaster} and send our
* subscriptions.
*/
private function registerWithMaster():void {
this.send.send('aphlict_master', 'register', this.client);
this.expiry = new Date().getTime() + (5 * AphlictClient.INTERVAL);
this.log('Registered client ' + this.client);
this.timer.start();
// Send subscriptions to master.
this.log('Sending subscriptions to master.');
this.send.send(
'aphlict_master',
'subscribe',
this.client,
this.subscriptions);
}
/**

Binary file not shown.