================ rvDebuggerServer::ProcessMessages Process all incoming network messages from the debugger client ================ */
| 169 | ================ |
| 170 | */ |
| 171 | bool rvDebuggerServer::ProcessMessages ( void ) |
| 172 | { |
| 173 | netadr_t adrFrom; |
| 174 | idBitMsg msg; |
| 175 | byte buffer[MAX_MSGLEN]; |
| 176 | |
| 177 | // Check for pending udp packets on the debugger port |
| 178 | int msgSize; |
| 179 | while ( mPort.GetPacket ( adrFrom, buffer, msgSize, MAX_MSGLEN) ) |
| 180 | { |
| 181 | short command; |
| 182 | msg.Init(buffer, sizeof(buffer)); |
| 183 | msg.SetSize(msgSize); |
| 184 | msg.BeginReading(); |
| 185 | |
| 186 | if ( adrFrom.type != NA_LOOPBACK ) { |
| 187 | // Only accept packets from the debugger server for security reasons |
| 188 | if ( !Sys_CompareNetAdrBase( adrFrom, mClientAdr ) ) |
| 189 | continue; |
| 190 | } |
| 191 | |
| 192 | command = msg.ReadShort( ); |
| 193 | |
| 194 | switch ( command ) |
| 195 | { |
| 196 | case DBMSG_CONNECT: |
| 197 | mConnected = true; |
| 198 | SendMessage ( DBMSG_CONNECTED ); |
| 199 | HandleInspectScripts ( NULL ); |
| 200 | com_editors |= EDITOR_DEBUGGER; |
| 201 | break; |
| 202 | |
| 203 | case DBMSG_CONNECTED: |
| 204 | mConnected = true; |
| 205 | HandleInspectScripts( NULL ); |
| 206 | com_editors |= EDITOR_DEBUGGER; |
| 207 | break; |
| 208 | |
| 209 | case DBMSG_DISCONNECT: |
| 210 | ClearBreakpoints ( ); |
| 211 | Resume ( ); |
| 212 | mConnected = false; |
| 213 | com_editors &= ~EDITOR_DEBUGGER; |
| 214 | break; |
| 215 | |
| 216 | case DBMSG_ADDBREAKPOINT: |
| 217 | HandleAddBreakpoint ( &msg ); |
| 218 | break; |
| 219 | |
| 220 | case DBMSG_REMOVEBREAKPOINT: |
| 221 | HandleRemoveBreakpoint ( &msg ); |
| 222 | break; |
| 223 | |
| 224 | case DBMSG_RESUME: |
| 225 | HandleResume ( &msg ); |
| 226 | break; |
| 227 | |
| 228 | case DBMSG_BREAK: |
nothing calls this directly
no test coverage detected