https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r104015 | kpfleming | 2008-02-21 08:33:51 -0600 (Thu, 21 Feb 2008) | 2 lines
reduce the likelihood that HTTP Manager session ids will consist of primarily '1' bits
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@104016
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
ast_mutex_init(&s->__lock);
ast_mutex_lock(&s->__lock);
s->inuse = 1;
- s->managerid = rand() | 1; /* make sure it is non-zero */
+ s->managerid = (rand() ^ (unsigned long) s) | 1; /* make sure it is non-zero */
s->last_ev = grab_last();
AST_LIST_LOCK(&sessions);
AST_LIST_INSERT_HEAD(&sessions, s, list);