Skip to content

Remove std::abort usage #134

Open
Open
@CuriousGeorgiy

Description

@CuriousGeorgiy

We use std::abort in two places:

template<class BUFFER, class NetProvider>
Response<BUFFER>
Connection<BUFFER, NetProvider>::getResponse(rid_t future)
{
//This method does not tolerate extracting wrong future.
//Firstly user should invoke futureIsReady() to make sure future
//is present.
auto entry = impl->futures.find(future);
#ifndef NDEBUG
if (entry == impl->futures.end())
std::abort();

template<class BUFFER, class NetProvider>
DecodeStatus
processResponse(Connection<BUFFER, NetProvider> &conn,
Response<BUFFER> *result)
{
//Decode response. In case of success - fill in feature map
//and adjust end-of-decoded data pointer. Call GC if needed.
if (! conn.impl->inBuf.has(conn.impl->endDecoded, MP_RESPONSE_SIZE))
return DECODE_NEEDMORE;
Response<BUFFER> response;
response.size = conn.impl->dec.decodeResponseSize();
if (response.size < 0) {
LOG_ERROR("Failed to decode response size");
//In case of corrupted response size all other data in the buffer
//is likely to be decoded in the wrong way (since we don't
// know how much bytes should be skipped). So let's simply
//terminate here.
std::abort();

This is unacceptable for library code — we need to inspect these places and find an alternative.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions