mirror of
https://github.com/pion/ice.git
synced 2025-09-27 11:52:18 +08:00
Improve performance of UDPMux map lookups
UDPMux is using a map to lookup addresses of each packets. Unfortunately the key is based on a string and each time we want to check the map, a conversion of the UDP address to string is made (.String()) which is expensive. This CR replace the string key by a binary key called ipPort. This structure contains a netip.Addr field and ipPort could be used as a map key
This commit is contained in:
@@ -133,6 +133,8 @@ var (
|
||||
errWriteSTUNMessage = errors.New("failed to send STUN message")
|
||||
errWriteSTUNMessageToIceConn = errors.New("failed to write STUN message to ICE connection")
|
||||
errXORMappedAddrTimeout = errors.New("timeout while waiting for XORMappedAddr")
|
||||
errFailedToCastUDPAddr = errors.New("failed to cast net.Addr to net.UDPAddr")
|
||||
errInvalidIPAddress = errors.New("invalid ip address")
|
||||
|
||||
// UDPMuxDefault should not listen on unspecified address, but to keep backward compatibility, don't return error now.
|
||||
// will be used in the future.
|
||||
|
Reference in New Issue
Block a user