Skip to content

Commit

Permalink
fixed compiler warning
Browse files Browse the repository at this point in the history
  • Loading branch information
EmielBruijntjes committed Nov 7, 2018
1 parent 428219a commit f0ad90d
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
32 changes: 31 additions & 1 deletion examples/libev.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,34 @@ class MyHandler : public AMQP::LibEvHandler
{
std::cout << "connected" << std::endl;
}

/**
* Method that is called when the TCP connection ends up in a ready
* @param connection The TCP connection
*/
virtual void onReady(AMQP::TcpConnection *connection) override
{
std::cout << "ready" << std::endl;
}

/**
* Method that is called when the TCP connection is closed
* @param connection The TCP connection
*/
virtual void onClosed(AMQP::TcpConnection *connection) override
{
std::cout << "closed" << std::endl;
}

/**
* Method that is called when the TCP connection is detached
* @param connection The TCP connection
*/
virtual void onDetached(AMQP::TcpConnection *connection) override
{
std::cout << "detached" << std::endl;
}


public:
/**
Expand Down Expand Up @@ -105,7 +133,7 @@ class MyTimer
_channel(channel), _queue(std::move(queue))
{
// initialize the libev structure
ev_timer_init(&_timer, callback, 0.005, 0.005);
ev_timer_init(&_timer, callback, 0.005, 1.005);

// this object is the data
_timer.data = this;
Expand Down Expand Up @@ -169,6 +197,8 @@ int main()

// construct a timer that is going to publish stuff
auto *timer = new MyTimer(loop, &channel, name);

//connection.close();
});

// run the loop
Expand Down
7 changes: 7 additions & 0 deletions include/amqpcpp/linux_tcp/tcpconnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ namespace AMQP {
* Forward declarations
*/
class TcpState;
class TcpChannel;

/**
* Class definition
Expand Down Expand Up @@ -50,6 +51,12 @@ class TcpConnection :
* @var Connection
*/
Connection _connection;

/**
* The channel may access out _connection
* @friend
*/
friend TcpChannel;


/**
Expand Down

0 comments on commit f0ad90d

Please sign in to comment.