Implement copy() for CandidateRelay

Relay candidates have an additional field "relayProtocol"
which is not marshaled and hence not copied by the
candidateBase's copy() method.

This change is required to properly expose the relay
protocol for via the agents GetSelectedCandidatePair()
function as it internally copies the candidates.
This commit is contained in:
Steffen Vogel
2022-11-14 16:01:28 +02:00
parent d415139840
commit bce6de3c84
+13
View File
@@ -79,3 +79,16 @@ func (c *CandidateRelay) close() error {
}
return err
}
func (c *CandidateRelay) copy() (Candidate, error) {
cc, err := c.candidateBase.copy()
if err != nil {
return nil, err
}
if ccr, ok := cc.(*CandidateRelay); ok {
ccr.relayProtocol = c.relayProtocol
}
return cc, nil
}