提交 f48ec61d authored 作者: Anthony Minessale's avatar Anthony Minessale

FS-7132 #resolve

上级 82512184
This diff was suppressed by a .gitattributes entry.
...@@ -308,10 +308,8 @@ var callbacks = { ...@@ -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");
......
...@@ -132,6 +132,9 @@ ...@@ -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 @@ ...@@ -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;
......
...@@ -305,6 +305,8 @@ static uint32_t jsock_unsub_head(jsock_t *jsock, jsock_sub_node_head_t *head) ...@@ -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) ...@@ -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);
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论