internal void TrackOption(SocketOptionLevel level, SocketOptionName name) { // As long as only these options are set, we can support Connect{Async}(IPAddress[], ...). switch (level) { case SocketOptionLevel.Tcp: switch (name) { case SocketOptionName.NoDelay: _trackedOptions |= TrackedSocketOptions.NoDelay; return; } break; case SocketOptionLevel.IP: switch (name) { case SocketOptionName.DontFragment: _trackedOptions |= TrackedSocketOptions.DontFragment; return; case SocketOptionName.IpTimeToLive: _trackedOptions |= TrackedSocketOptions.Ttl; return; } break; case SocketOptionLevel.IPv6: switch (name) { case SocketOptionName.IPv6Only: _trackedOptions |= TrackedSocketOptions.DualMode; return; case SocketOptionName.IpTimeToLive: _trackedOptions |= TrackedSocketOptions.Ttl; return; } break; case SocketOptionLevel.Socket: switch (name) { case SocketOptionName.Broadcast: _trackedOptions |= TrackedSocketOptions.EnableBroadcast; return; case SocketOptionName.Linger: _trackedOptions |= TrackedSocketOptions.LingerState; return; case SocketOptionName.ReceiveBuffer: _trackedOptions |= TrackedSocketOptions.ReceiveBufferSize; return; case SocketOptionName.ReceiveTimeout: _trackedOptions |= TrackedSocketOptions.ReceiveTimeout; return; case SocketOptionName.SendBuffer: _trackedOptions |= TrackedSocketOptions.SendBufferSize; return; case SocketOptionName.SendTimeout: _trackedOptions |= TrackedSocketOptions.SendTimeout; return; } break; } // For any other settings, we need to track that they were used so that we can error out // if a Connect{Async}(IPAddress[],...) attempt is made. ExposedHandleOrUntrackedConfiguration = true; }
internal bool IsTrackedOption(TrackedSocketOptions option) => (_trackedOptions & option) != 0;
public bool IsTrackedOption(TrackedSocketOptions option) => (_trackedOptions & option) != 0;