Process Log packets, exit when receive Exception or EndOfStream
| 2345 | |
| 2346 | /// Process Log packets, exit when receive Exception or EndOfStream |
| 2347 | bool ClientBase::receiveEndOfQueryForInsert() |
| 2348 | { |
| 2349 | while (true) |
| 2350 | { |
| 2351 | Packet packet = connection->receivePacket(); |
| 2352 | |
| 2353 | switch (packet.type) |
| 2354 | { |
| 2355 | case Protocol::Server::EndOfStream: |
| 2356 | onEndOfStream(); |
| 2357 | return true; |
| 2358 | |
| 2359 | case Protocol::Server::Exception: |
| 2360 | onReceiveExceptionFromServer(std::move(packet.exception)); |
| 2361 | /// We cannot be sure that in case of exception all data had been sent to the server |
| 2362 | /// and we either need to send Cancel or disconnect, disconnect is more stable. |
| 2363 | connection->disconnect(); |
| 2364 | return false; |
| 2365 | |
| 2366 | case Protocol::Server::Log: |
| 2367 | onLogData(packet.block); |
| 2368 | break; |
| 2369 | |
| 2370 | case Protocol::Server::Progress: |
| 2371 | onProgress(packet.progress); |
| 2372 | break; |
| 2373 | |
| 2374 | case Protocol::Server::ProfileEvents: |
| 2375 | onProfileEvents(packet.block); |
| 2376 | break; |
| 2377 | |
| 2378 | case Protocol::Server::TimezoneUpdate: |
| 2379 | onTimezoneUpdate(packet.server_timezone); |
| 2380 | break; |
| 2381 | |
| 2382 | default: |
| 2383 | throw NetException(ErrorCodes::UNEXPECTED_PACKET_FROM_SERVER, |
| 2384 | "Unexpected packet from server (expected Exception, EndOfStream, Log, Progress or ProfileEvents. Got {})", |
| 2385 | String(Protocol::Server::toString(packet.type))); |
| 2386 | } |
| 2387 | } |
| 2388 | } |
| 2389 | |
| 2390 | bool ClientBase::sendCancel(std::exception_ptr exception_ptr) |
| 2391 | { |
nothing calls this directly
no test coverage detected