FS-7132 #resolve

This commit is contained in:
Anthony Minessale 2015-01-05 21:14:35 -06:00
parent 825121843f
commit f48ec61d54
4 changed files with 240 additions and 3429 deletions

File diff suppressed because it is too large Load Diff

View File

@ -308,10 +308,8 @@ var callbacks = {
}, },
onWSClose: function(v, success) { onWSClose: function(v, success) {
if ($('#online').is(':visible')) { display("");
display(""); online(false);
online(false);
}
var today = new Date(); var today = new Date();
$("#errordisplay").html("Connection Error.<br>Last Attempt: " + today); $("#errordisplay").html("Connection Error.<br>Last Attempt: " + today);
goto_page("main"); goto_page("main");

View File

@ -132,6 +132,9 @@
$.verto.prototype.logout = function(msg) { $.verto.prototype.logout = function(msg) {
var verto = this; var verto = this;
verto.rpcClient.closeSocket(); verto.rpcClient.closeSocket();
if (verto.callbacks.onWSClose) {
verto.callbacks.onWSClose(verto, false);
}
verto.purge(); verto.purge();
}; };
@ -490,6 +493,10 @@
}; };
} else { } else {
switch (data.method) { switch (data.method) {
case 'verto.punt':
verto.purge();
verto.logout();
break;
case 'verto.event': case 'verto.event':
var list = null; var list = null;
var key = null; var key = null;

View File

@ -305,6 +305,8 @@ static uint32_t jsock_unsub_head(jsock_t *jsock, jsock_sub_node_head_t *head)
return x; return x;
} }
static void detach_calls(jsock_t *jsock);
static void unsub_all_jsock(void) static void unsub_all_jsock(void)
{ {
switch_hash_index_t *hi; switch_hash_index_t *hi;
@ -1059,8 +1061,30 @@ static jsock_t *get_jsock(const char *uuid)
static void attach_jsock(jsock_t *jsock) static void attach_jsock(jsock_t *jsock)
{ {
jsock_t *jp;
int proceed = 1;
switch_mutex_lock(globals.jsock_mutex); switch_mutex_lock(globals.jsock_mutex);
switch_core_hash_insert(globals.jsock_hash, jsock->uuid_str, jsock);
if ((jp = switch_core_hash_find(globals.jsock_hash, jsock->uuid_str))) {
if (jp == jsock) {
proceed = 0;
} else {
cJSON *params = NULL;
cJSON *msg = NULL;
msg = jrpc_new_req("verto.punt", NULL, &params);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "New connection for session %s dropping previous connection.\n", jsock->uuid_str);
switch_core_hash_delete(globals.jsock_hash, jsock->uuid_str);
ws_write_json(jp, &msg, SWITCH_TRUE);
cJSON_Delete(msg);
jp->drop = 1;
}
}
if (proceed) {
switch_core_hash_insert(globals.jsock_hash, jsock->uuid_str, jsock);
}
switch_mutex_unlock(globals.jsock_mutex); switch_mutex_unlock(globals.jsock_mutex);
} }