jigar-joshi / libjingle

Automatically exported from code.google.com/p/libjingle
0 stars 0 forks source link

MessageQueue bug #202

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Start some p2p host
2. Try to simultaneously connect to that host more than 2 clients
3. Connection will never be established

Problem in MessageGet function. 

while (!msgq_.empty()) 
{
  *pmsg = msgq_.front();
  if (pmsg->ts_sensitive) 
  {
    long delay = TimeDiff(msCurrent, pmsg->ts_sensitive);
    if (delay > 0) {
      LOG_F(LS_WARNING) << "id: " << pmsg->message_id << "  delay: "
                        << (delay + kMaxMsgLatency) << "ms";
    }
  }
  msgq_.pop_front();
  if (MQID_DISPOSE == pmsg->message_id) 
  {
    ASSERT(NULL == pmsg->phandler);
    delete pmsg->pdata;
    continue;
  }
  return true;
}

Obviously, if the message queue is always non empty, then wait for the 
socketserver will never be executed.
Possible solution is calling ss_->Wait before return true

Original issue reported on code.google.com by cybe...@gmail.com on 24 Aug 2011 at 12:51