Tweak send/receive visibility
This commit is contained in:
parent
12f1d7b0ce
commit
81118e6606
@ -315,6 +315,29 @@ namespace fr
|
||||
return type;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Overridable send, to allow
|
||||
* custom types to be directly sent through
|
||||
* sockets.
|
||||
*
|
||||
* @param socket The socket to send through
|
||||
* @return Status indicating if the send succeeded or not.
|
||||
*/
|
||||
Socket::Status send(Socket *socket) const override;
|
||||
|
||||
/*!
|
||||
* Overrideable receive, to allow
|
||||
* custom types to be directly received through
|
||||
* sockets.
|
||||
*
|
||||
* @param socket The socket to send through
|
||||
* @return Status indicating if the send succeeded or not:
|
||||
* 'Success': All good, object still valid.
|
||||
* 'WouldBlock' or 'Timeout': No data received. Object still valid though.
|
||||
* Anything else: Object invalid. Call disconnect().
|
||||
*/
|
||||
Socket::Status receive(Socket *socket) override;
|
||||
|
||||
protected:
|
||||
/*!
|
||||
* Splits a string by new line. Ignores escaped \n's
|
||||
@ -340,28 +363,7 @@ namespace fr
|
||||
*/
|
||||
void parse_header_line(const std::string &str);
|
||||
|
||||
/*!
|
||||
* Overridable send, to allow
|
||||
* custom types to be directly sent through
|
||||
* sockets.
|
||||
*
|
||||
* @param socket The socket to send through
|
||||
* @return Status indicating if the send succeeded or not.
|
||||
*/
|
||||
Socket::Status send(Socket *socket) const override;
|
||||
|
||||
/*!
|
||||
* Overrideable receive, to allow
|
||||
* custom types to be directly received through
|
||||
* sockets.
|
||||
*
|
||||
* @param socket The socket to send through
|
||||
* @return Status indicating if the send succeeded or not:
|
||||
* 'Success': All good, object still valid.
|
||||
* 'WouldBlock' or 'Timeout': No data received. Object still valid though.
|
||||
* Anything else: Object invalid. Call disconnect().
|
||||
*/
|
||||
Socket::Status receive(Socket *socket) override;
|
||||
|
||||
//Other request info
|
||||
std::unordered_map<std::string, std::string> header_data;
|
||||
|
||||
@ -690,9 +690,6 @@ namespace fr
|
||||
return buffer.size() <= PACKET_HEADER_LENGTH ? 0 : buffer.size() - PACKET_HEADER_LENGTH;
|
||||
}
|
||||
|
||||
private:
|
||||
friend class Socket;
|
||||
|
||||
/*!
|
||||
* Overridable send, to allow
|
||||
* custom types to be directly sent through
|
||||
@ -748,10 +745,13 @@ namespace fr
|
||||
status = socket->receive_all(&buffer[PACKET_HEADER_LENGTH], packet_length);
|
||||
} while(status == fr::Socket::Status::WouldBlock);
|
||||
if(status == fr::Socket::Status::Timeout)
|
||||
status = fr::Socket::Status::Disconnected;
|
||||
status = fr::Socket::Status::Disconnected;
|
||||
return status;
|
||||
}
|
||||
|
||||
private:
|
||||
friend class Socket;
|
||||
|
||||
|
||||
mutable std::string buffer; //Packet data buffer
|
||||
size_t buffer_read_index; //Current read position
|
||||
|
||||
@ -94,7 +94,6 @@ namespace fr
|
||||
final = is_final;
|
||||
}
|
||||
|
||||
protected:
|
||||
/*!
|
||||
* Overridable send, to allow
|
||||
* custom types to be directly sent through
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user