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

View file

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