Skip to content

Commit 138d5df

Browse files
committed
fix calling srt_close on the same descriptor twice
If client code calls `Close` on a connection, there's a chance that when `Close` is called in the finalizer, the library will free the socket two times
1 parent 5ecc7b5 commit 138d5df

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

srtgo.go

+1
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ func (s *SrtSocket) SetWriteDeadline(deadline time.Time) {
279279
func (s *SrtSocket) Close() {
280280

281281
C.srt_close(s.socket)
282+
s.socket = SRT_INVALID_SOCK
282283
if !s.blocking {
283284
s.pd.close()
284285
}

0 commit comments

Comments
 (0)