Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sonnyp committed Dec 22, 2024
1 parent eb52715 commit 968204f
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 117 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ unit:
e2e:
$(warning e2e tests require prosody-trunk and luarocks)
cd server && prosodyctl --config prosody.cfg.lua install mod_sasl2 > /dev/null
# https://github.com/xmppjs/xmpp.js/pull/1006
# cd server && prosodyctl --config prosody.cfg.lua install mod_sasl2_bind2 > /dev/null
# cd server && prosodyctl --config prosody.cfg.lua install mod_sasl2_fast > /dev/null
# cd server && prosodyctl --config prosody.cfg.lua install mod_sasl2_sm > /dev/null
Expand Down
2 changes: 1 addition & 1 deletion packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"saslmechanisms": "^0.1.1"
},
"browser": "./browser.js",
"react-native": "./react-native.js",
"react-native": "./browser.js",
"engines": {
"node": ">= 20"
},
Expand Down
94 changes: 0 additions & 94 deletions packages/client/react-native.js

This file was deleted.

5 changes: 1 addition & 4 deletions packages/stream-features/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ export default function route() {
return next();

const prevent = await next();
// BIND2 inline handler may have already set to online, eg inline SM resume
if (!prevent && entity.jid && entity.status !== "online") {
entity._status("online", entity.jid);
}
if (!prevent && entity.jid) entity._status("online", entity.jid);
};
}
23 changes: 8 additions & 15 deletions packages/stream-management/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ export default function streamManagement({
outbound: 0,
inbound: 0,
max: null,
outbound_q: [],
};

entity.on("online", (jid) => {
Expand Down Expand Up @@ -87,29 +86,23 @@ export default function streamManagement({
// https://xmpp.org/extensions/xep-0198.html#enable
// For client-to-server connections, the client MUST NOT attempt to enable stream management until after it has completed Resource Binding unless it is resuming a previous session

function resumeSuccess() {
sm.enabled = true;
if (address) entity.jid = address;
entity.status = "online";
}

function resumeFailed() {
sm.id = "";
sm.enabled = false;
sm.outbound = 0;
}

streamFeatures.use("sm", NS, async (context, next) => {
// Resuming
if (sm.id) {
try {
resumeSuccess(await resume(entity, sm.inbound, sm.id));
await resume(entity, sm.inbound, sm.id);
sm.enabled = true;
entity.jid = address;
entity.status = "online";
return true;
// If resumption fails, continue with session establishment
} catch {
resumeFailed();
sm.id = "";
sm.enabled = false;
sm.outbound = 0;
}
}

// Enabling

// Resource binding first
Expand Down
7 changes: 4 additions & 3 deletions server/prosody.cfg.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ modules_enabled = {
"version";
"smacks";
"sasl2";
"sasl2_bind2";
"sasl2_fast";
"sasl2_sm";
-- https://github.com/xmppjs/xmpp.js/pull/1006
-- "sasl2_bind2";
-- "sasl2_fast";
-- "sasl2_sm";
};

modules_disabled = {
Expand Down

0 comments on commit 968204f

Please sign in to comment.