ソースを参照

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

dev1
paweldomas 9年前
コミット
1ccf494169
1個のファイルの変更8行の追加6行の削除
  1. 8
    6
      modules/xmpp/strophe.jingle.js

+ 8
- 6
modules/xmpp/strophe.jingle.js ファイルの表示

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

読み込み中…
キャンセル
保存