Skip to content

Commit ff36b13

Browse files
committed
fix(stream): add extra limits to ensure all the pending request futures are thread safe
1 parent acc24ae commit ff36b13

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

crates/interledger-stream/src/client.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ pub async fn send_money<S, A>(
7373
source_amount: u64,
7474
) -> Result<(StreamDelivery, S), Error>
7575
where
76-
S: IncomingService<A> + Clone + 'static,
77-
A: Account + 'static,
76+
S: IncomingService<A> + Send + Sync + Clone + 'static,
77+
A: Account + Send + Sync + 'static,
7878
{
7979
let shared_secret = Bytes::from(shared_secret);
8080
let from_account = from_account.clone();
@@ -160,7 +160,7 @@ struct SendMoneyFuture<S: IncomingService<A>, A: Account> {
160160
struct PendingRequest {
161161
sequence: u64,
162162
amount: u64,
163-
future: Pin<Box<dyn Future<Output = IlpResult>>>,
163+
future: Pin<Box<dyn Future<Output = IlpResult> + Send>>,
164164
}
165165

166166
/// The state of the send money future
@@ -178,8 +178,8 @@ enum SendMoneyFutureState {
178178
#[project]
179179
impl<S, A> SendMoneyFuture<S, A>
180180
where
181-
S: IncomingService<A> + Clone + 'static,
182-
A: Account + 'static,
181+
S: IncomingService<A> + Send + Sync + Clone + 'static,
182+
A: Account + Send + Sync + 'static,
183183
{
184184
/// Fire off requests until the congestion controller tells us to stop or we've sent the total amount or maximum time since last fulfill has elapsed
185185
fn try_send_money(&mut self) -> Result<bool, Error> {
@@ -454,8 +454,8 @@ where
454454

455455
impl<S, A> Future for SendMoneyFuture<S, A>
456456
where
457-
S: IncomingService<A> + Clone + 'static,
458-
A: Account + 'static,
457+
S: IncomingService<A> + Send + Sync + Clone + 'static,
458+
A: Account + Send + Sync + 'static,
459459
{
460460
type Output = Result<(StreamDelivery, S), Error>;
461461

0 commit comments

Comments
 (0)