[icecast-dev] redundant code ?
Michael Smith
msmith at xiph.org
Wed Feb 11 16:31:12 PST 2004
On Thursday 12 February 2004 02:36, Mihai RUSU wrote:
> Hi
>
> In connection.c arround line 847 icecast2 does:
> if (global.clients >= client_limit) {
> client_send_504(client,
> "The server is already full. Try again later.");
> global_unlock();
> return;
> }
>
> Then just a little bit later, does the same thing in the if (source) {}
> block.
>
> Is this code redundant ?
No. The first check comes early - it allows us to reject the client
immediately if there's no chance of it being allowed in.
Then, in the second check, we've already found the source that this client is
being connected to, and we check again - this time, if the check succeeds,
the global client count is incremented.
The first check isn't required, but it does allow us to reduce the amount of
work done in the common case.
Mike
--- >8 ----
List archives: http://www.xiph.org/archives/
icecast project homepage: http://www.icecast.org/
To unsubscribe from this list, send a message to 'icecast-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the Icecast-dev
mailing list