aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2020-02-20 11:56:48 -0500
committerDeterminant <[email protected]>2020-02-20 11:56:48 -0500
commitbb1c884a2f466cccbc4e719f8ec021e627f2dda3 (patch)
tree720e892b9cd099f267c7c83826fd1e8d13c3c0c7 /src
parent49d48637032dcf42c5fcf8a4062a7daca2c32231 (diff)
fix the potential data race in known_peers
Diffstat (limited to 'src')
-rw-r--r--src/network.cpp24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/network.cpp b/src/network.cpp
index 286c3ef..4182a41 100644
--- a/src/network.cpp
+++ b/src/network.cpp
@@ -227,27 +227,35 @@ peernetwork_t *peernetwork_new(const eventcontext_t *ec, const peernetwork_confi
void peernetwork_free(const peernetwork_t *self) { delete self; }
-int32_t peernetwork_add_peer(peernetwork_t *self, const peerid_t *pid) {
- return self->add_peer(*pid);
+int32_t peernetwork_add_peer(peernetwork_t *self, const peerid_t *peer) {
+ return self->add_peer(*peer);
}
-int32_t peernetwork_del_peer(peernetwork_t *self, const peerid_t *pid) {
- return self->del_peer(*pid);
+int32_t peernetwork_del_peer(peernetwork_t *self, const peerid_t *peer) {
+ return self->del_peer(*peer);
}
-bool peernetwork_has_peer(const peernetwork_t *self, const peerid_t *pid) {
- return self->has_peer(*pid);
+int32_t peernetwork_conn_peer(peernetwork_t *self, const peerid_t *peer, ssize_t ntry, double retry_delay) {
+ return self->conn_peer(*peer, ntry, retry_delay);
+}
+
+bool peernetwork_has_peer(const peernetwork_t *self, const peerid_t *peer) {
+ return self->has_peer(*peer);
}
const peernetwork_conn_t *peernetwork_get_peer_conn(const peernetwork_t *self,
- const peerid_t *pid,
+ const peerid_t *peer,
SalticidaeCError *cerror) {
SALTICIDAE_CERROR_TRY(cerror)
- return new peernetwork_conn_t(self->get_peer_conn(*pid));
+ return new peernetwork_conn_t(self->get_peer_conn(*peer));
SALTICIDAE_CERROR_CATCH(cerror)
return nullptr;
}
+int32_t peernetwork_set_peer_addr(peernetwork_t *self, const peerid_t *peer, const netaddr_t *addr) {
+ return self->set_peer_addr(*peer, *addr);
+}
+
msgnetwork_t *peernetwork_as_msgnetwork(peernetwork_t *self) { return self; }
peernetwork_t *msgnetwork_as_peernetwork_unsafe(msgnetwork_t *self) {