New function rconn_get_ip().
This commit is contained in:
1 parent
809743618e
commit
4532f9cdfb
2 files changed
+11
No files matched your search
@@ -36,6 +36,7 @@
|
||||
|
||||
#include "queue.h"
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <time.h>
|
||||
|
||||
/* A wrapper around vconn that provides queuing and optionally reliability.
|
||||
@@ -72,4 +73,6 @@ bool rconn_is_alive(const struct rconn *);
|
||||
bool rconn_is_connected(const struct rconn *);
|
||||
int rconn_disconnected_duration(const struct rconn *);
|
||||
|
||||
uint32_t rconn_get_ip(const struct rconn *);
|
||||
|
||||
#endif /* rconn.h */
|
||||
@@ -324,6 +324,14 @@ rconn_disconnected_duration(const struct rconn *rconn)
|
||||
{
|
||||
return rconn_is_connected(rconn) ? 0 : time(0) - rconn->last_connected;
|
||||
}
|
||||
|
||||
/* Returns the IP address of the peer, or 0 if the peer is not connected over
|
||||
* an IP-based protocol or if its IP address is not known. */
|
||||
uint32_t
|
||||
rconn_get_ip(const struct rconn *rconn)
|
||||
{
|
||||
return rconn->vconn ? vconn_get_ip(rconn->vconn) : 0;
|
||||
}
|
||||
|
||||
static struct rconn *
|
||||
create_rconn(const char *name, int txq_limit, int probe_interval,
|
||||
|
||||
Reference in new issue
Block a user