(sessionId string)
| 328 | } |
| 329 | |
| 330 | func (group *Group) KickSession(sessionId string) bool { |
| 331 | group.mutex.Lock() |
| 332 | defer group.mutex.Unlock() |
| 333 | |
| 334 | Log.Infof("[%s] kick session. session id=%s", group.UniqueKey, sessionId) |
| 335 | |
| 336 | if strings.HasPrefix(sessionId, base.UkPreRtmpServerSession) { |
| 337 | if group.rtmpPubSession != nil && group.rtmpPubSession.UniqueKey() == sessionId { |
| 338 | group.rtmpPubSession.Dispose() |
| 339 | return true |
| 340 | } |
| 341 | for s := range group.rtmpSubSessionSet { |
| 342 | if s.UniqueKey() == sessionId { |
| 343 | s.Dispose() |
| 344 | return true |
| 345 | } |
| 346 | } |
| 347 | } else if strings.HasPrefix(sessionId, base.UkPreRtmpPullSession) || strings.HasPrefix(sessionId, base.UkPreRtspPullSession) { |
| 348 | return group.kickPull(sessionId) |
| 349 | } else if strings.HasPrefix(sessionId, base.UkPreRtspPubSession) { |
| 350 | if group.rtspPubSession != nil && group.rtspPubSession.UniqueKey() == sessionId { |
| 351 | group.rtspPubSession.Dispose() |
| 352 | return true |
| 353 | } |
| 354 | } else if strings.HasPrefix(sessionId, base.UkPrePsPubSession) { |
| 355 | if group.psPubSession != nil && group.psPubSession.UniqueKey() == sessionId { |
| 356 | group.psPubSession.Dispose() |
| 357 | return true |
| 358 | } |
| 359 | } else if strings.HasPrefix(sessionId, base.UkPreFlvSubSession) { |
| 360 | // TODO chef: 考虑数据结构改成sessionIdzuokey的map |
| 361 | for s := range group.httpflvSubSessionSet { |
| 362 | if s.UniqueKey() == sessionId { |
| 363 | s.Dispose() |
| 364 | return true |
| 365 | } |
| 366 | } |
| 367 | } else if strings.HasPrefix(sessionId, base.UkPreTsSubSession) { |
| 368 | for s := range group.httptsSubSessionSet { |
| 369 | if s.UniqueKey() == sessionId { |
| 370 | s.Dispose() |
| 371 | return true |
| 372 | } |
| 373 | } |
| 374 | } else if strings.HasPrefix(sessionId, base.UkPreRtspSubSession) { |
| 375 | for s := range group.rtspSubSessionSet { |
| 376 | if s.UniqueKey() == sessionId { |
| 377 | s.Dispose() |
| 378 | return true |
| 379 | } |
| 380 | } |
| 381 | } else { |
| 382 | Log.Errorf("[%s] kick session while session id format invalid. %s", group.UniqueKey, sessionId) |
| 383 | } |
| 384 | |
| 385 | return false |
| 386 | } |
| 387 |
no test coverage detected