aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/salticidae/event.h20
-rw-r--r--include/salticidae/network.h3
-rw-r--r--include/salticidae/stream.h4
-rw-r--r--include/salticidae/util.h1
4 files changed, 15 insertions, 13 deletions
diff --git a/include/salticidae/event.h b/include/salticidae/event.h
index d3625d5..b243865 100644
--- a/include/salticidae/event.h
+++ b/include/salticidae/event.h
@@ -528,13 +528,11 @@ class MPSCQueueEventDriven: public MPSCQueue<T> {
public:
MPSCQueueEventDriven():
- wait_sig(true),
- fd(eventfd(0, EFD_NONBLOCK)) {}
-
- ~MPSCQueueEventDriven() {
- ev.clear();
- close(fd);
+ wait_sig(true),
+ fd(eventfd(0, EFD_NONBLOCK)) {
+ if (fd == -1) throw SalticidaeError(SALTI_ERROR_FD);
}
+ ~MPSCQueueEventDriven() { close(fd); }
template<typename Func>
void reg_handler(const EventContext &ec, Func &&func) {
@@ -585,13 +583,11 @@ class MPMCQueueEventDriven: public MPMCQueue<T> {
public:
MPMCQueueEventDriven():
- wait_sig(true),
- fd(eventfd(0, EFD_NONBLOCK)) {}
-
- ~MPMCQueueEventDriven() {
- evs.clear();
- close(fd);
+ wait_sig(true),
+ fd(eventfd(0, EFD_NONBLOCK)) {
+ if (fd == -1) throw SalticidaeError(SALTI_ERROR_FD);
}
+ ~MPMCQueueEventDriven() { close(fd); }
// this function is *NOT* thread-safe
template<typename Func>
diff --git a/include/salticidae/network.h b/include/salticidae/network.h
index 6c8b7fd..0bae6c5 100644
--- a/include/salticidae/network.h
+++ b/include/salticidae/network.h
@@ -992,7 +992,7 @@ msgnetwork_t *msgnetwork_new(const eventcontext_t *ec, const msgnetwork_config_t
void msgnetwork_free(const msgnetwork_t *self);
void msgnetwork_send_msg(msgnetwork_t *self, const msg_t *msg, const msgnetwork_conn_t *conn);
void msgnetwork_send_msg_deferred_by_move(msgnetwork_t *self, msg_t *_moved_msg, const msgnetwork_conn_t *conn);
-msgnetwork_conn_t *msgnetwork_connect(msgnetwork_t *self, const netaddr_t *addr, SalticidaeCError *err);
+msgnetwork_conn_t *msgnetwork_connect(msgnetwork_t *self, const netaddr_t *addr, bool blocking, SalticidaeCError *err);
msgnetwork_conn_t *msgnetwork_conn_copy(const msgnetwork_conn_t *self);
void msgnetwork_conn_free(const msgnetwork_conn_t *self);
void msgnetwork_listen(msgnetwork_t *self, const netaddr_t *listen_addr, SalticidaeCError *err);
@@ -1013,6 +1013,7 @@ void msgnetwork_reg_error_handler(msgnetwork_t *self, msgnetwork_error_callback_
msgnetwork_t *msgnetwork_conn_get_net(const msgnetwork_conn_t *conn);
msgnetwork_conn_mode_t msgnetwork_conn_get_mode(const msgnetwork_conn_t *conn);
const netaddr_t *msgnetwork_conn_get_addr(const msgnetwork_conn_t *conn);
+const x509_t *msgnetwork_conn_get_peer_cert(const msgnetwork_conn_t *conn);
/* PeerNetwork */
diff --git a/include/salticidae/stream.h b/include/salticidae/stream.h
index 50a67dd..7d1456e 100644
--- a/include/salticidae/stream.h
+++ b/include/salticidae/stream.h
@@ -494,6 +494,7 @@ extern "C" {
uint256_t *uint256_new();
uint256_t *uint256_new_from_bytes(const uint8_t *arr);
+uint256_t *uint256_new_from_bytearray(const bytearray_t *bytes);
void uint256_free(const uint256_t *self);
bool uint256_is_null(const uint256_t *self);
@@ -503,6 +504,8 @@ void uint256_unserialize(uint256_t *self, datastream_t *s);
datastream_t *datastream_new();
datastream_t *datastream_new_from_bytes(const uint8_t *base, size_t size);
+datastream_t *datastream_new_from_bytearray(const bytearray_t *bytes);
+datastream_t *datastream_new_moved_from_bytearray(bytearray_t *bytes);
void datastream_free(const datastream_t *self);
datastream_t *datastream_copy(const datastream_t *self);
@@ -534,6 +537,7 @@ int64_t datastream_get_i64(datastream_t *self, bool *succ);
const uint8_t *datastream_get_data_inplace(datastream_t *self, size_t len);
uint256_t *datastream_get_hash(const datastream_t *self);
bytearray_t *bytearray_new_moved_from_datastream(datastream_t *_moved_self);
+bytearray_t *bytearray_new_from_hex(const char *hex_str);
char *datastream_get_hex(datastream_t *self);
diff --git a/include/salticidae/util.h b/include/salticidae/util.h
index 9102842..952b18b 100644
--- a/include/salticidae/util.h
+++ b/include/salticidae/util.h
@@ -98,6 +98,7 @@ enum SalticidaeErrorCode {
SALTI_ERROR_TLS_KEY,
SALTI_ERROR_TLS_KEY_NOT_MATCH,
SALTI_ERROR_TLS_NO_PEER_CERT,
+ SALTI_ERROR_FD,
SALTI_ERROR_UNKNOWN
};