remove duplicate methods

This commit is contained in:
aler9
2021-10-27 19:15:22 +02:00
parent 31a34d81c1
commit eb7bf2614b
3 changed files with 12 additions and 20 deletions

View File

@@ -363,8 +363,8 @@ outer:
case req := <-s.sessionRequest:
if ss, ok := s.sessions[req.id]; ok {
if !req.sc.ip().Equal(ss.ip()) ||
req.sc.zone() != ss.zone() {
if !req.sc.ip().Equal(ss.author.ip()) ||
req.sc.zone() != ss.author.zone() {
req.res <- sessionRequestRes{
res: &base.Response{
StatusCode: base.StatusBadRequest,

View File

@@ -218,14 +218,6 @@ func (ss *ServerSession) AnnouncedTracks() []ServerSessionAnnouncedTrack {
return ss.announcedTracks
}
func (ss *ServerSession) ip() net.IP {
return ss.author.ip()
}
func (ss *ServerSession) zone() string {
return ss.author.zone()
}
func (ss *ServerSession) checkState(allowed map[ServerSessionState]struct{}) error {
if _, ok := allowed[ss.state]; ok {
return nil
@@ -849,7 +841,7 @@ func (ss *ServerSession) handleRequest(sc *ServerConn, req *base.Request) (*base
case TransportUDP:
for trackID, track := range ss.setuppedTracks {
// readers can send RTCP packets
sc.s.udpRTCPListener.addClient(ss.ip(), track.udpRTCPPort, ss, trackID, false)
sc.s.udpRTCPListener.addClient(ss.author.ip(), track.udpRTCPPort, ss, trackID, false)
// open the firewall by sending packets to the counterpart
ss.WriteFrame(trackID, StreamTypeRTCP,
@@ -923,8 +915,8 @@ func (ss *ServerSession) handleRequest(sc *ServerConn, req *base.Request) (*base
switch *ss.setuppedTransport {
case TransportUDP:
for trackID, track := range ss.setuppedTracks {
ss.s.udpRTPListener.addClient(ss.ip(), track.udpRTPPort, ss, trackID, true)
ss.s.udpRTCPListener.addClient(ss.ip(), track.udpRTCPPort, ss, trackID, true)
ss.s.udpRTPListener.addClient(ss.author.ip(), track.udpRTPPort, ss, trackID, true)
ss.s.udpRTCPListener.addClient(ss.author.ip(), track.udpRTCPPort, ss, trackID, true)
// open the firewall by sending packets to the counterpart
ss.WriteFrame(trackID, StreamTypeRTP,
@@ -1069,14 +1061,14 @@ func (ss *ServerSession) WriteFrame(trackID int, streamType StreamType, payload
if streamType == StreamTypeRTP {
ss.s.udpRTPListener.write(payload, &net.UDPAddr{
IP: ss.ip(),
Zone: ss.zone(),
IP: ss.author.ip(),
Zone: ss.author.zone(),
Port: track.udpRTPPort,
})
} else {
ss.s.udpRTCPListener.write(payload, &net.UDPAddr{
IP: ss.ip(),
Zone: ss.zone(),
IP: ss.author.ip(),
Zone: ss.author.zone(),
Port: track.udpRTCPPort,
})
}

View File

@@ -132,8 +132,8 @@ func (st *ServerStream) readerAdd(
// check whether client ports are already in use by another reader.
for r := range st.readersUnicast {
if *r.setuppedTransport == TransportUDP &&
r.ip().Equal(ss.ip()) &&
r.zone() == ss.zone() {
r.author.ip().Equal(ss.author.ip()) &&
r.author.zone() == ss.author.zone() {
for _, rt := range r.setuppedTracks {
if rt.udpRTPPort == clientPorts[0] {
return liberrors.ErrServerUDPPortsAlreadyInUse{Port: rt.udpRTPPort}
@@ -199,7 +199,7 @@ func (st *ServerStream) readerSetActive(ss *ServerSession) {
default: // UDPMulticast
for trackID := range ss.setuppedTracks {
st.multicastListeners[trackID].rtcpListener.addClient(
ss.ip(), st.multicastListeners[trackID].rtcpListener.port(), ss, trackID, false)
ss.author.ip(), st.multicastListeners[trackID].rtcpListener.port(), ss, trackID, false)
}
}
}