| 1375 | } |
| 1376 | |
| 1377 | Packet Connection::receivePacket() |
| 1378 | { |
| 1379 | try |
| 1380 | { |
| 1381 | ensureConnected(); |
| 1382 | |
| 1383 | Packet res; |
| 1384 | |
| 1385 | /// Have we already read packet type? |
| 1386 | if (last_input_packet_type) |
| 1387 | { |
| 1388 | res.type = *last_input_packet_type; |
| 1389 | last_input_packet_type.reset(); |
| 1390 | } |
| 1391 | else |
| 1392 | { |
| 1393 | readVarUInt(res.type, *in); |
| 1394 | } |
| 1395 | |
| 1396 | switch (res.type) |
| 1397 | { |
| 1398 | case Protocol::Server::Data: |
| 1399 | case Protocol::Server::Totals: |
| 1400 | case Protocol::Server::Extremes: |
| 1401 | res.block = receiveData(); |
| 1402 | return res; |
| 1403 | |
| 1404 | case Protocol::Server::Exception: |
| 1405 | res.exception = receiveException(); |
| 1406 | return res; |
| 1407 | |
| 1408 | case Protocol::Server::Progress: |
| 1409 | res.progress = receiveProgress(); |
| 1410 | return res; |
| 1411 | |
| 1412 | case Protocol::Server::ProfileInfo: |
| 1413 | res.profile_info = receiveProfileInfo(); |
| 1414 | return res; |
| 1415 | |
| 1416 | case Protocol::Server::Log: |
| 1417 | res.block = receiveLogData(); |
| 1418 | return res; |
| 1419 | |
| 1420 | case Protocol::Server::TableColumns: |
| 1421 | res.columns_description = receiveTableColumns(); |
| 1422 | return res; |
| 1423 | |
| 1424 | case Protocol::Server::EndOfStream: |
| 1425 | return res; |
| 1426 | |
| 1427 | case Protocol::Server::PartUUIDs: |
| 1428 | { |
| 1429 | // allow_experimental_query_deduplication is no longer supported, but an old server |
| 1430 | // may still send this packet. Skip the obsolete, peer-controlled payload without |
| 1431 | // materializing it (do not resize a vector to a peer-chosen size). |
| 1432 | UInt64 num_part_uuids = 0; |
| 1433 | readVarUInt(num_part_uuids, *in); |
| 1434 | if (num_part_uuids > DEFAULT_MAX_STRING_SIZE) |
no test coverage detected