@yuneta/gobj-js 7.7.0 → 7.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2631,10 +2631,16 @@ var gobjJs = (function(exports) {
2631
2631
  function set_log_callback(fn) {
2632
2632
  __log_callback__ = typeof fn === "function" ? fn : null;
2633
2633
  }
2634
+ var __in_log_callback__ = false;
2634
2635
  function emit_log_callback(level, msg, hora) {
2635
- if (__log_callback__) try {
2636
- __log_callback__(level, msg, hora);
2637
- } catch (e) {}
2636
+ if (__log_callback__ && !__in_log_callback__) {
2637
+ __in_log_callback__ = true;
2638
+ try {
2639
+ __log_callback__(level, msg, hora);
2640
+ } catch (e) {} finally {
2641
+ __in_log_callback__ = false;
2642
+ }
2643
+ }
2638
2644
  }
2639
2645
  function set_remote_log_functions(remote_log_fn) {
2640
2646
  if (remote_log_fn) {
@@ -5584,7 +5590,7 @@ var gobjJs = (function(exports) {
5584
5590
  ***************************************************************/
5585
5591
  function mt_subscription_added(gobj, subs) {
5586
5592
  let priv = gobj.priv;
5587
- if (gobj_current_state(gobj) !== "ST_SESSION") return 0;
5593
+ if (gobj_current_state(gobj) !== "ST_SESSION" || !priv.websocket) return 0;
5588
5594
  if (priv.inside_on_open) return 0;
5589
5595
  return send_remote_subscription(gobj, subs);
5590
5596
  }
@@ -5593,7 +5599,7 @@ var gobjJs = (function(exports) {
5593
5599
  ***************************************************************/
5594
5600
  function mt_subscription_deleted(gobj, subs) {
5595
5601
  let priv = gobj.priv;
5596
- if (gobj_current_state(gobj) !== "ST_SESSION") return 0;
5602
+ if (gobj_current_state(gobj) !== "ST_SESSION" || !priv.websocket) return 0;
5597
5603
  if (priv.inside_on_open) return 0;
5598
5604
  if (empty_string(subs.event)) return 0;
5599
5605
  let kw = {};
@@ -5714,6 +5720,10 @@ var gobjJs = (function(exports) {
5714
5720
  trace_ievent_callback(prefix, iev, 1, size);
5715
5721
  } else trace_inter_event(gobj, prefix, iev);
5716
5722
  }
5723
+ if (!priv.websocket || priv.websocket.readyState !== WebSocket.OPEN) {
5724
+ log_warning(`${gobj_short_name(gobj)}: send_iev(): websocket not open, message lost`);
5725
+ return -1;
5726
+ }
5717
5727
  try {
5718
5728
  priv.websocket.send(msg);
5719
5729
  } catch (e) {