mirror of
https://github.com/netbirdio/ice.git
synced 2026-05-22 17:10:58 -07:00
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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user