@@ -125,31 +125,18 @@ namespace libp2p {
125125 * @brief Initiates connection to the peer {@param peer_info}.
126126 * @param peer_info peer to connect.
127127 * @param handler callback, will be executed on success or fail
128- * @param timeout in milliseconds
129128 */
130129 virtual void connect (const peer::PeerInfo &peer_info,
131- const ConnectionResultHandler &handler,
132- std::chrono::milliseconds timeout) = 0;
133-
134- /* *
135- * @brief Initiates connection to the peer {@param peer_info}.
136- * @param peer_info peer to connect.
137- * @param handler callback, will be executed on success or fail
138- */
139- inline void connect (const peer::PeerInfo &peer_info,
140- const ConnectionResultHandler &handler) {
141- connect (peer_info, handler, std::chrono::milliseconds::zero ());
142- };
130+ const ConnectionResultHandler &handler) = 0;
143131
144132 /* *
145133 * @brief Initiates connection to the peer {@param peer_info}. If connection
146134 * exists, does nothing.
147135 * @param peer_info peer to connect.
148136 */
149137 inline void connect (const peer::PeerInfo &peer_info) {
150- connect (
151- peer_info, [](auto &&) {}, std::chrono::milliseconds::zero ());
152- };
138+ connect (peer_info, [](ConnectionResult &&) {});
139+ }
153140
154141 /* *
155142 * Closes all connections (outbound and inbound) to given {@param peer_id}
@@ -158,16 +145,14 @@ namespace libp2p {
158145
159146 /* *
160147 * @brief Open new stream to the peer {@param peer_info} with protocol
161- * {@param protocol} with a specific timeout.
148+ * {@param protocol}
162149 * @param peer_info stream will be opened to this peer
163150 * @param protocols "speak" using first supported protocol
164151 * @param cb callback, will be executed on success or fail
165- * @param timeout in milliseconds
166152 */
167153 virtual void newStream (const peer::PeerInfo &peer_info,
168154 StreamProtocols protocols,
169- StreamAndProtocolOrErrorCb cb,
170- std::chrono::milliseconds timeout = {}) = 0;
155+ StreamAndProtocolOrErrorCb cb) = 0;
171156
172157 /* *
173158 * @brief Open new stream to the peer {@param peer} with protocol
@@ -176,9 +161,11 @@ namespace libp2p {
176161 * @param protocols "speak" using first supported protocol
177162 * @param cb callback, will be executed on success or fail
178163 */
179- virtual void newStream (const peer::PeerId &peer_id,
180- StreamProtocols protocols,
181- StreamAndProtocolOrErrorCb cb) = 0;
164+ void newStream (const PeerId &peer_id,
165+ StreamProtocols protocols,
166+ StreamAndProtocolOrErrorCb cb) {
167+ newStream (PeerInfo{.id = peer_id}, std::move (protocols), std::move (cb));
168+ }
182169
183170 /* *
184171 * @brief Create listener on given multiaddress.
0 commit comments