Przeglądaj źródła

Fixes error type not set correctly on jingle error response, adds more warnings

dev1
paweldomas 9 lat temu
rodzic
commit
1ccf494169
1 zmienionych plików z 8 dodań i 6 usunięć
  1. 8
    6
      modules/xmpp/strophe.jingle.js

+ 8
- 6
modules/xmpp/strophe.jingle.js Wyświetl plik

@@ -61,18 +61,20 @@ module.exports = function(XMPP, eventEmitter) {
61 61
             logger.log('on jingle ' + action + ' from ' + fromJid, iq);
62 62
             var sess = this.sessions[sid];
63 63
             if ('session-initiate' != action) {
64
-                if (sess === null) {
65
-                    ack.type = 'error';
64
+                if (!sess) {
65
+                    ack.attrs({ type: 'error' });
66 66
                     ack.c('error', {type: 'cancel'})
67 67
                         .c('item-not-found', {xmlns: 'urn:ietf:params:xml:ns:xmpp-stanzas'}).up()
68 68
                         .c('unknown-session', {xmlns: 'urn:xmpp:jingle:errors:1'});
69
+                    logger.warn('invalid session id', iq);
69 70
                     this.connection.send(ack);
70 71
                     return true;
71 72
                 }
72 73
                 // local jid is not checked
73 74
                 if (fromJid != sess.peerjid) {
74
-                    logger.warn('jid mismatch for session id', sid, fromJid, sess.peerjid);
75
-                    ack.type = 'error';
75
+                    logger.warn(
76
+                        'jid mismatch for session id', sid, sess.peerjid, iq);
77
+                    ack.attrs({ type: 'error' });
76 78
                     ack.c('error', {type: 'cancel'})
77 79
                         .c('item-not-found', {xmlns: 'urn:ietf:params:xml:ns:xmpp-stanzas'}).up()
78 80
                         .c('unknown-session', {xmlns: 'urn:xmpp:jingle:errors:1'});
@@ -82,10 +84,10 @@ module.exports = function(XMPP, eventEmitter) {
82 84
             } else if (sess !== undefined) {
83 85
                 // existing session with same session id
84 86
                 // this might be out-of-order if the sess.peerjid is the same as from
85
-                ack.type = 'error';
87
+                ack.attrs({ type: 'error' });
86 88
                 ack.c('error', {type: 'cancel'})
87 89
                     .c('service-unavailable', {xmlns: 'urn:ietf:params:xml:ns:xmpp-stanzas'}).up();
88
-                logger.warn('duplicate session id', sid);
90
+                logger.warn('duplicate session id', sid, iq);
89 91
                 this.connection.send(ack);
90 92
                 return true;
91 93
             }

Ładowanie…
Anuluj
Zapisz