mirror of
https://github.com/badaix/snapcast.git
synced 2025-08-02 08:09:35 +02:00
Code comments
This commit is contained in:
parent
c1cb395eb0
commit
a88e218d91
6 changed files with 51 additions and 8 deletions
|
@ -37,6 +37,7 @@ using boost::asio::ip::tcp;
|
|||
class ClientConnection;
|
||||
|
||||
|
||||
/// Used to synchronize server requests (wait for server response)
|
||||
struct PendingRequest
|
||||
{
|
||||
PendingRequest(uint16_t reqId) : id(reqId), response(NULL) {};
|
||||
|
@ -47,6 +48,7 @@ struct PendingRequest
|
|||
};
|
||||
|
||||
|
||||
/// Interface: callback for a received message and error reporting
|
||||
class MessageReceiver
|
||||
{
|
||||
public:
|
||||
|
@ -55,16 +57,26 @@ public:
|
|||
};
|
||||
|
||||
|
||||
/// Endpoint of the server connection
|
||||
/**
|
||||
* Server connection endpoint.
|
||||
* Messages are sent to the server with the "send" method (async).
|
||||
* Messages are sent sync to server with the sendReq method.
|
||||
*/
|
||||
class ClientConnection
|
||||
{
|
||||
public:
|
||||
/// ctor. Received message from the server are passed to MessageReceiver
|
||||
ClientConnection(MessageReceiver* receiver, const std::string& ip, size_t port);
|
||||
virtual ~ClientConnection();
|
||||
virtual void start();
|
||||
virtual void stop();
|
||||
virtual bool send(const msg::BaseMessage* message) const;
|
||||
|
||||
/// Send request to the server and wait for answer
|
||||
virtual std::shared_ptr<msg::SerializedMessage> sendRequest(const msg::BaseMessage* message, const chronos::msec& timeout = chronos::msec(1000));
|
||||
|
||||
/// Send request to the server and wait for answer of type T
|
||||
template <typename T>
|
||||
std::shared_ptr<T> sendReq(const msg::BaseMessage* message, const chronos::msec& timeout = chronos::msec(1000))
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue