mirror of
https://github.com/aler9/gortsplib
synced 2025-10-05 07:06:58 +08:00
make most methods thread safe (#882)
Client: Stats ServerConn: Session, Stats ServerSession: State, Stats, Medias, Path, Query, Stream, SetuppedSecure, SetuppedTransport, AnnouncedDescription
This commit is contained in:
@@ -211,6 +211,7 @@ func (st *ServerStream) Stats() *ServerStreamStats {
|
||||
func (st *ServerStream) readerAdd(
|
||||
ss *ServerSession,
|
||||
clientPorts *[2]int,
|
||||
protocol Transport,
|
||||
) error {
|
||||
st.mutex.Lock()
|
||||
defer st.mutex.Unlock()
|
||||
@@ -219,11 +220,11 @@ func (st *ServerStream) readerAdd(
|
||||
return liberrors.ErrServerStreamClosed{}
|
||||
}
|
||||
|
||||
switch *ss.setuppedTransport {
|
||||
switch protocol {
|
||||
case TransportUDP:
|
||||
// check whether UDP ports and IP are already assigned to another reader
|
||||
for r := range st.readers {
|
||||
if *r.setuppedTransport == TransportUDP &&
|
||||
if protocol == TransportUDP &&
|
||||
r.author.ip().Equal(ss.author.ip()) &&
|
||||
r.author.zone() == ss.author.zone() {
|
||||
for _, rt := range r.setuppedMedias {
|
||||
|
Reference in New Issue
Block a user