send gate: re-check the brake after the gate wait, before the PUT
A send queued at the room gate passed the brake check at entry only, so a brake placed while it waited still let the PUT through. The check now also runs inside the gate, just before the PUT, and answers a typed Brake refusal. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
2387cbc7f6
commit
7adc7315a3
2 changed files with 18 additions and 0 deletions
|
|
@ -332,6 +332,7 @@ export function createMouth({
|
|||
const newer = await newerThan(roomId, basis);
|
||||
if (newer.length > 0) return refuse("RoomMoved", newer);
|
||||
}
|
||||
if (!(await released())) return refuse("Brake"); // a brake placed during the gate wait or the head read stops this send
|
||||
const sent = await matrix("PUT", `/rooms/${encodeURIComponent(roomId)}/send/m.room.message/${encodeURIComponent(requestId)}`, { msgtype: "m.text", body: text }, API, AbortSignal.timeout(sendTimeoutMs));
|
||||
return { requestId, eventId: sent.event_id, refusal: null, newer: [] };
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue