| 650 | |
| 651 | |
| 652 | void SipInterface::siDrive2() |
| 653 | { |
| 654 | // All inbound SIP messages go here for processing. |
| 655 | |
| 656 | LOG(DEBUG) << "blocking on socket"; |
| 657 | int numRead = mSIPSocket->read(mReadBuffer); |
| 658 | if (numRead<0) { |
| 659 | LOG(ALERT) << "cannot read SIP socket."; |
| 660 | return; |
| 661 | } |
| 662 | if (numRead<10) { |
| 663 | LOG(WARNING) << "malformed packet (" << numRead << " bytes) on SIP socket"; |
| 664 | return; |
| 665 | } |
| 666 | mReadBuffer[numRead] = '\0'; |
| 667 | if (random()%100 < gConfig.getNum("Test.SIP.SimulatedPacketLoss")) { |
| 668 | LOG(NOTICE) << "simulating dropped inbound SIP packet: " << mReadBuffer; |
| 669 | return; |
| 670 | } |
| 671 | |
| 672 | newDriveIncoming(mReadBuffer); |
| 673 | } |
| 674 | |
| 675 | static void driveLoop2( SipInterface * si) |
| 676 | { |