Log denemesi

This commit is contained in:
Sedat Öztürk 2025-08-31 22:14:32 +03:00
parent b0566b7c6b
commit 0db26ba738
2 changed files with 11 additions and 6 deletions

View file

@ -110,15 +110,15 @@ export class SignalRService {
})
this.connection.onclose(async (err) => {
// 🚨 İlk satırda kontrol et
console.warn('🔥 onclose triggered, isKicked=', this.isKicked)
if (this.isKicked) {
this.isConnected = false
this.currentSessionId = undefined
return
return // ❗ Kick durumunda kesinlikle LeaveClass çağırma
}
this.isConnected = false
try {
if (this.currentSessionId) {
await this.connection.invoke('LeaveClass', this.currentSessionId)
@ -147,12 +147,17 @@ export class SignalRService {
this.isKicked = true
// 🔑 Cleanupu dışarıya delege et
if (this.onForceCleanup) {
console.warn('⚡ ForceCleanup callback çağrılıyor')
this.onForceCleanup()
}
try {
await this.connection.stop()
} catch (e) {
console.warn('connection.stop hata:', e)
}
this.isConnected = false
if (this.currentSessionId && store.getState().auth.user) {

View file

@ -355,7 +355,7 @@ const RoomDetail: React.FC = () => {
signalRServiceRef.current.setForceCleanupHandler(() => {
webRTCServiceRef.current?.closeAllConnections()
localStream?.getTracks().forEach((track) => track.stop())
localStream?.getTracks().forEach((t) => t.stop())
})
signalRServiceRef.current.setParticipantLeaveHandler(({ userId, sessionId }) => {