-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 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 ? - -- Mihai RUSU Email: dizzy@roedu.net GPG : http://dizzy.roedu.net/dizzy-gpg.txt WWW: http://dizzy.roedu.net "Linux is obsolete" -- AST -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (GNU/Linux) iD8DBQFAKkvsPZzOzrZY/1QRAv2fAJ4/xcjHVC+c2J6nJHd4E8mtTJ9XeACcDW4e k+izMkkYqK1FLuU2f5KS8N8=7a/D -----END PGP SIGNATURE----- --- >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@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
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@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Thu, 12 Feb 2004, Michael Smith wrote:> > > > 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.Ok.> 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.You mean that beeing multithreaded application the counter may have been incremented from the last check so better to check it again just before increment (while holding a lock on it). Thanks, Im having dificulties understanding all this as I have never (yet) programmed multi-threaded applications heh :)> Mike- -- Mihai RUSU Email: dizzy@roedu.net GPG : http://dizzy.roedu.net/dizzy-gpg.txt WWW: http://dizzy.roedu.net "Linux is obsolete" -- AST -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (GNU/Linux) iD8DBQFAKy1DPZzOzrZY/1QRApkGAJ9rHzDTNnPYa+ej7bzwDOYMRqByXgCdEt2b MW9hnghEfQadp/3Y+kAC/po=pwi1 -----END PGP SIGNATURE----- --- >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@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.