Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove noexcept from p2p #260

Merged
merged 1 commit into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions include/libp2p/basic/scheduler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace libp2p::basic {
* Defers callback to be executed during the next IO loop cycle
* @param cb callback
*/
void schedule(Callback &&cb) noexcept {
void schedule(Callback &&cb) {
std::ignore = scheduleImpl(std::move(cb), Time::zero(), false);
}

Expand All @@ -49,8 +49,7 @@ namespace libp2p::basic {
* @param cb callback
* @param delay_from_now time interval
*/
void schedule(Callback &&cb,
std::chrono::milliseconds delay_from_now) noexcept {
void schedule(Callback &&cb, std::chrono::milliseconds delay_from_now) {
std::ignore = scheduleImpl(std::move(cb), delay_from_now, false);
}

Expand All @@ -60,7 +59,7 @@ namespace libp2p::basic {
* @return handle which can be used for cancelling, rescheduling, and scoped
* lifetime
*/
[[nodiscard]] Handle scheduleWithHandle(Callback &&cb) noexcept {
[[nodiscard]] Handle scheduleWithHandle(Callback &&cb) {
return scheduleImpl(std::move(cb), Time::zero(), true);
}

Expand All @@ -72,15 +71,15 @@ namespace libp2p::basic {
* lifetime
*/
[[nodiscard]] Handle scheduleWithHandle(
Callback &&cb, std::chrono::milliseconds delay_from_now) noexcept {
Callback &&cb, std::chrono::milliseconds delay_from_now) {
return scheduleImpl(std::move(cb), delay_from_now, true);
}

/**
* Backend's async
* @return milliseconds since async's epoch
*/
virtual std::chrono::milliseconds now() const noexcept = 0;
virtual std::chrono::milliseconds now() const = 0;

/**
* Doesn't allow lvalue callbacks
Expand All @@ -99,6 +98,6 @@ namespace libp2p::basic {
*/
virtual Handle scheduleImpl(Callback &&cb,
std::chrono::milliseconds delay_from_now,
bool make_handle) noexcept = 0;
bool make_handle) = 0;
};
} // namespace libp2p::basic
2 changes: 1 addition & 1 deletion include/libp2p/basic/scheduler/asio_scheduler_backend.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace libp2p::basic {
/**
* @return Milliseconds since steady clock's epoch
*/
std::chrono::milliseconds now() const noexcept override;
std::chrono::milliseconds now() const override;

/**
* Sets the timer. Called by Scheduler implementation
Expand Down
4 changes: 2 additions & 2 deletions include/libp2p/basic/scheduler/backend.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace libp2p::basic {
/**
* Called from backend to fire callbacks
*/
virtual void pulse() noexcept = 0;
virtual void pulse() = 0;
};

/**
Expand All @@ -44,7 +44,7 @@ namespace libp2p::basic {
* Current async
* @return Milliseconds elapsed from async's epoch
*/
virtual std::chrono::milliseconds now() const noexcept = 0;
virtual std::chrono::milliseconds now() const = 0;

/**
* Implementation-defined defer or delay function.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace libp2p::basic {
/**
* @return Milliseconds since clock's epoch. Clock is set manually
*/
std::chrono::milliseconds now() const noexcept override {
std::chrono::milliseconds now() const override {
return current_clock_;
}

Expand Down
6 changes: 3 additions & 3 deletions include/libp2p/basic/scheduler/scheduler_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ namespace libp2p::basic {
Scheduler::Config config);

/// Returns current async
std::chrono::milliseconds now() const noexcept override;
std::chrono::milliseconds now() const override;

/// Scheduler API impl
Handle scheduleImpl(Callback &&cb,
std::chrono::milliseconds delay_from_now,
bool make_handle) noexcept override;
bool make_handle) override;

/// Timer callback, called from SchedulerBackend
void pulse() noexcept override;
void pulse() override;

private:
size_t callReady(Time now);
Expand Down
2 changes: 1 addition & 1 deletion include/libp2p/connection/layer_connection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace libp2p::connection {

/// returns if this side is an initiator of this connection, or false if it
/// was a server in that case
virtual bool isInitiator() const noexcept = 0;
virtual bool isInitiator() const = 0;

/**
* @brief Get local multiaddress for this connection.
Expand Down
4 changes: 2 additions & 2 deletions include/libp2p/event/bus.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ namespace libp2p::event {
* Explicitly unsubscribe from channel before the lifetime
* of this object expires
*/
void unsubscribe() noexcept {
void unsubscribe() {
if (handle_.connected()) {
try {
handle_.disconnect();
Expand All @@ -78,7 +78,7 @@ namespace libp2p::event {
Handle() = default;

/// Cancels existing connection
Handle &operator=(Handle &&rhs) noexcept {
Handle &operator=(Handle &&rhs) {
unsubscribe();
handle_ = std::move(rhs.handle_);

Expand Down
2 changes: 1 addition & 1 deletion include/libp2p/layer/websocket/ssl_connection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace libp2p::connection {
std::shared_ptr<LayerConnection> connection,
std::shared_ptr<boost::asio::ssl::context> ssl_context);

bool isInitiator() const noexcept override;
bool isInitiator() const override;
outcome::result<multi::Multiaddress> localMultiaddr() override;
outcome::result<multi::Multiaddress> remoteMultiaddr() override;

Expand Down
2 changes: 1 addition & 1 deletion include/libp2p/layer/websocket/ws_connection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ namespace libp2p::connection {
std::shared_ptr<LayerConnection> connection,
std::shared_ptr<basic::Scheduler> scheduler);

bool isInitiator() const noexcept override;
bool isInitiator() const override;

void start();
void stop();
Expand Down
4 changes: 2 additions & 2 deletions include/libp2p/multi/multihash.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ namespace libp2p::multi {
public:
Multihash(const Multihash &other) = default;
Multihash &operator=(const Multihash &other) = default;
Multihash(Multihash &&other) noexcept = default;
Multihash &operator=(Multihash &&other) noexcept = default;
Multihash(Multihash &&other) = default;
Multihash &operator=(Multihash &&other) = default;
~Multihash() = default;

using Buffer = Bytes;
Expand Down
2 changes: 1 addition & 1 deletion include/libp2p/muxer/mplex/mplex.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace libp2p::muxer {
public:
explicit Mplex(MuxedConnectionConfig config);

peer::ProtocolName getProtocolId() const noexcept override;
peer::ProtocolName getProtocolId() const override;

void muxConnection(std::shared_ptr<connection::SecureConnection> conn,
CapConnCallbackFunc cb) const override;
Expand Down
6 changes: 3 additions & 3 deletions include/libp2p/muxer/mplex/mplex_stream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ namespace libp2p::connection {

void deferWriteCallback(std::error_code ec, WriteCallbackFunc cb) override;

bool isClosed() const noexcept override;
bool isClosed() const override;

void close(VoidResultHandlerFunc cb) override;

bool isClosedForRead() const noexcept override;
bool isClosedForRead() const override;

bool isClosedForWrite() const noexcept override;
bool isClosedForWrite() const override;

void reset() override;

Expand Down
6 changes: 3 additions & 3 deletions include/libp2p/muxer/mplex/mplexed_connection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ namespace libp2p::connection {

MplexedConnection(const MplexedConnection &other) = delete;
MplexedConnection &operator=(const MplexedConnection &other) = delete;
MplexedConnection(MplexedConnection &&other) noexcept = delete;
MplexedConnection &operator=(MplexedConnection &&other) noexcept = delete;
MplexedConnection(MplexedConnection &&other) = delete;
MplexedConnection &operator=(MplexedConnection &&other) = delete;
~MplexedConnection() override = default;

void start() override;
Expand All @@ -52,7 +52,7 @@ namespace libp2p::connection {

outcome::result<crypto::PublicKey> remotePublicKey() const override;

bool isInitiator() const noexcept override;
bool isInitiator() const override;

outcome::result<multi::Multiaddress> localMultiaddr() override;

Expand Down
2 changes: 1 addition & 1 deletion include/libp2p/muxer/yamux/yamux.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace libp2p::muxer {
std::shared_ptr<basic::Scheduler> scheduler,
std::shared_ptr<network::ConnectionManager> cmgr);

peer::ProtocolName getProtocolId() const noexcept override;
peer::ProtocolName getProtocolId() const override;

void muxConnection(std::shared_ptr<connection::SecureConnection> conn,
CapConnCallbackFunc cb) const override;
Expand Down
6 changes: 3 additions & 3 deletions include/libp2p/muxer/yamux/yamux_stream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ namespace libp2p::connection {

void deferWriteCallback(std::error_code ec, WriteCallbackFunc cb) override;

bool isClosed() const noexcept override;
bool isClosed() const override;

void close(VoidResultHandlerFunc cb) override;

bool isClosedForRead() const noexcept override;
bool isClosedForRead() const override;

bool isClosedForWrite() const noexcept override;
bool isClosedForWrite() const override;

void reset() override;

Expand Down
2 changes: 1 addition & 1 deletion include/libp2p/muxer/yamux/yamuxed_connection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ namespace libp2p::connection {

outcome::result<crypto::PublicKey> remotePublicKey() const override;

bool isInitiator() const noexcept override;
bool isInitiator() const override;

outcome::result<multi::Multiaddress> localMultiaddr() override;

Expand Down
4 changes: 2 additions & 2 deletions include/libp2p/peer/peer_address.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ namespace libp2p::peer {
* Get a PeerId in this address
* @return peer id
*/
const PeerId &getId() const noexcept;
const PeerId &getId() const;

/**
* Get a Multiaddress in this address
* @return multiaddress
*/
const multi::Multiaddress &getAddress() const noexcept;
const multi::Multiaddress &getAddress() const;

private:
/**
Expand Down
4 changes: 2 additions & 2 deletions include/libp2p/peer/peer_id.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ namespace libp2p::peer {
public:
PeerId(const PeerId &other) = default;
PeerId &operator=(const PeerId &other) = default;
PeerId(PeerId &&other) noexcept = default;
PeerId &operator=(PeerId &&other) noexcept = default;
PeerId(PeerId &&other) = default;
PeerId &operator=(PeerId &&other) = default;
~PeerId() = default;

enum class FactoryError { SUCCESS = 0, SHA256_EXPECTED = 1 };
Expand Down
4 changes: 2 additions & 2 deletions include/libp2p/peer/peer_info.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ namespace libp2p::peer {
}

struct EqualByPeerId {
bool operator()(const PeerInfo &lhs, const PeerInfo &rhs) const noexcept {
bool operator()(const PeerInfo &lhs, const PeerInfo &rhs) const {
return lhs.id == rhs.id;
}
};

struct CompareByPeerId {
bool operator()(const PeerInfo &lhs, const PeerInfo &rhs) const noexcept {
bool operator()(const PeerInfo &lhs, const PeerInfo &rhs) const {
return lhs.id.toVector() < rhs.id.toVector();
}
};
Expand Down
2 changes: 1 addition & 1 deletion include/libp2p/protocol/common/subscription.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace libp2p::protocol {
Subscription(Subscription &&) = default;

Subscription();
Subscription &operator=(Subscription &&) noexcept;
Subscription &operator=(Subscription &&);
Subscription(uint64_t ticket, std::weak_ptr<Source> source);
~Subscription();

Expand Down
6 changes: 3 additions & 3 deletions include/libp2p/protocol/identify/identify_msg_processor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,19 @@ namespace libp2p::protocol {
* Get a Host of this processor
* @return Host
*/
Host &getHost() const noexcept;
Host &getHost() const;

/**
* Get a ConnectionManager of this processor
* @return ConnectionManager
*/
network::ConnectionManager &getConnectionManager() const noexcept;
network::ConnectionManager &getConnectionManager() const;

/**
* Get an ObservedAddresses of this processor
* @return ObservedAddresses
*/
const ObservedAddresses &getObservedAddresses() const noexcept;
const ObservedAddresses &getObservedAddresses() const;

private:
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace libp2p::protocol::kademlia {
distance_(NodeId(peer_id).distance(NodeId(std::forward<T>(target)))) {
}

bool operator<(const PeerIdWithDistance &other) const noexcept {
bool operator<(const PeerIdWithDistance &other) const {
return std::memcmp(
distance_.data(), other.distance_.data(), distance_.size())
< 0;
Expand Down
2 changes: 1 addition & 1 deletion include/libp2p/security/noise/noise_connection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ namespace libp2p::connection {

void deferWriteCallback(std::error_code ec, WriteCallbackFunc cb) override;

bool isInitiator() const noexcept override;
bool isInitiator() const override;

outcome::result<multi::Multiaddress> localMultiaddr() override;

Expand Down
2 changes: 1 addition & 1 deletion include/libp2p/security/plaintext/plaintext_connection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace libp2p::connection {

outcome::result<crypto::PublicKey> remotePublicKey() const override;

bool isInitiator() const noexcept override;
bool isInitiator() const override;

outcome::result<multi::Multiaddress> localMultiaddr() override;

Expand Down
2 changes: 1 addition & 1 deletion include/libp2p/security/secio/secio_connection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ namespace libp2p::connection {

outcome::result<crypto::PublicKey> remotePublicKey() const override;

bool isInitiator() const noexcept override;
bool isInitiator() const override;

outcome::result<multi::Multiaddress> localMultiaddr() override;

Expand Down
5 changes: 2 additions & 3 deletions include/libp2p/storage/sqlite.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ namespace libp2p::storage {
* @return number of rows affected, -1 in case of error
*/
template <typename... Args>
inline int execCommand(StatementHandle st_handle,
const Args &...args) noexcept {
inline int execCommand(StatementHandle st_handle, const Args &...args) {
try {
auto &st = getStatement(st_handle);
bindArgs(st, args...);
Expand All @@ -91,7 +90,7 @@ namespace libp2p::storage {
template <typename Sink, typename... Args>
inline bool execQuery(StatementHandle st_handle,
Sink &&sink,
const Args &...args) noexcept {
const Args &...args) {
try {
auto &st = getStatement(st_handle);
bindArgs(st, args...);
Expand Down
2 changes: 1 addition & 1 deletion include/libp2p/transport/tcp/tcp_connection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ namespace libp2p::transport {

outcome::result<multi::Multiaddress> localMultiaddr() override;

bool isInitiator() const noexcept override;
bool isInitiator() const override;

outcome::result<void> close() override;

Expand Down
2 changes: 1 addition & 1 deletion src/basic/scheduler/asio_scheduler_backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace libp2p::basic {
io_context_->post(std::move(cb));
}

std::chrono::milliseconds AsioSchedulerBackend::now() const noexcept {
std::chrono::milliseconds AsioSchedulerBackend::now() const {
return nowImpl();
}

Expand Down
Loading
Loading