From 3d51f8c27808605a2e3f368a5e6eaac4c6d05459 Mon Sep 17 00:00:00 2001 From: hy05190134 Date: Mon, 18 Apr 2016 11:27:26 +0800 Subject: [PATCH] Update conn.go add some question point statements and modify --- conn.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/conn.go b/conn.go index 9b43afe..92f7a2c 100644 --- a/conn.go +++ b/conn.go @@ -484,6 +484,8 @@ func (conn *conn) CreateMediaChunkStream() (*OutboundChunkStream, error) { newChunkStreamID = uint32((index+1)*6 + 2) logger.ModulePrintf(logHandler, log.LOG_LEVEL_DEBUG, "index: %d, newChunkStreamID: %d\n", index, newChunkStreamID) + // since allocate a newChunkStreamID, why not set the cocupited to true + conn.mediaChunkStreamIDAllocator[index] = true break } } @@ -510,8 +512,10 @@ func (conn *conn) InboundChunkStream(id uint32) (chunkStream *InboundChunkStream } func (conn *conn) CloseMediaChunkStream(id uint32) { + // and the id is not the index of Allocator slice + index := (id - 2) / 6 - 1 conn.mediaChunkStreamIDAllocatorLocker.Lock() - conn.mediaChunkStreamIDAllocator[id] = false + conn.mediaChunkStreamIDAllocator[index] = false conn.mediaChunkStreamIDAllocatorLocker.Unlock() conn.CloseChunkStream(id) }