SHA256
Звонки: фиксы session fallback/registry, аналитика ICE/TURN, авточек UI-версии и перенос кнопки разработчика
This commit is contained in:
+5
-3
@@ -81,10 +81,12 @@ public final class ActiveConnectionsRegistry {
|
||||
String login = ctx.getLogin();
|
||||
|
||||
if (sessionId != null && !sessionId.isBlank()) {
|
||||
ConnectionContext removed = bySessionId.remove(sessionId);
|
||||
// Удаляем только если под ключом всё ещё лежит именно этот ctx.
|
||||
// Иначе это старое соединение после re-register, и удалять новый ctx нельзя.
|
||||
boolean removedCurrent = bySessionId.remove(sessionId, ctx);
|
||||
|
||||
// Если в мапе лежал другой ctx под тем же sessionId — не трогаем его byLogin
|
||||
if (removed != null && removed != ctx) {
|
||||
// Если в мапе уже другой ctx под тем же sessionId — не трогаем byLogin.
|
||||
if (!removedCurrent) {
|
||||
log.debug("remove(ctx): sessionId mapped to another ctx, skip byLogin cleanup (sessionId={})", sessionId);
|
||||
return;
|
||||
}
|
||||
|
||||
+10
-1
@@ -16,6 +16,8 @@ import server.logic.ws_protocol.WireCodes;
|
||||
import shine.db.dao.SolanaUsersDAO;
|
||||
import shine.db.entities.SolanaUserEntry;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public class Net_CallSignalToSession_Handler implements JsonMessageHandler {
|
||||
private static final ObjectMapper MAPPER = new ObjectMapper();
|
||||
|
||||
@@ -44,7 +46,14 @@ public class Net_CallSignalToSession_Handler implements JsonMessageHandler {
|
||||
|
||||
ConnectionContext targetCtx = ActiveConnectionsRegistry.getInstance().getBySessionId(targetSessionId);
|
||||
if (targetCtx == null || !to.equalsIgnoreCase(targetCtx.getLogin())) {
|
||||
return NetExceptionResponseFactory.error(req, 404, "SESSION_NOT_FOUND", "Целевая сессия не найдена");
|
||||
// Fallback: если точной сессии уже нет (переподключение), но у пользователя ровно 1 активная сессия,
|
||||
// отправляем в неё, чтобы не ронять звонок из-за устаревшего targetSessionId.
|
||||
Set<ConnectionContext> activeForLogin = ActiveConnectionsRegistry.getInstance().getByLogin(to);
|
||||
if (activeForLogin.size() == 1) {
|
||||
targetCtx = activeForLogin.iterator().next();
|
||||
} else {
|
||||
return NetExceptionResponseFactory.error(req, 404, "SESSION_NOT_FOUND", "Целевая сессия не найдена");
|
||||
}
|
||||
}
|
||||
|
||||
String eventId = NetIdGenerator.eventId("evt");
|
||||
|
||||
Reference in New Issue
Block a user