@@ -196,21 +196,19 @@ impl UnifiedQueue {
196196 log:: info!( "Bump-Bump payload exchange: new_request(id={}) has payload={:?}, matched_request(id={}) has payload={:?}" ,
197197 new_request_id, new_request_payload, matched_request_id, matched_request_payload) ;
198198
199- // Important: Our goal is for each side to receive the OTHER side's payload
200- // The MatchResult for the send side (which will be sent to device A) needs to contain the payload from device B (matched_request_payload)
201- // The MatchResult for the receive side (which will be sent to device B) needs to contain the payload from device A (new_request_payload)
199+ // Important: For bump endpoints, each side needs to receive the OTHER side's payload
200+ // For simplicity, we'll use the directly obtained payloads:
201+ // - New request should receive matched request's payload
202+ // - Matched request should receive new request's payload
202203
203- // Now we need to map those payloads correctly to our send/receive variables
204- // Note that send_ref is the new_request and receive_ref is the matched_request
205- // So if send_receives receives matched_request_payload and receive_receives receives new_request_payload,
206- // we'll have the correct payload exchange
207- if send_ref. id == new_request_id {
208- // Normal case: send is new_request, receive is matched_request
204+ // FIXED: Always ensure correct payload mapping regardless of which is send_ref/receive_ref
205+ if new_request. id == send_ref. id {
206+ // New request is mapped to send_ref, matched request is mapped to receive_ref
209207 log:: info!( "Payload mapping: send(id={}) receives payload from matched(id={}), receive(id={}) receives payload from new(id={})" ,
210208 send_ref. id, matched_request_id, receive_ref. id, new_request_id) ;
211209 ( matched_request_payload, new_request_payload)
212210 } else {
213- // Reversed case: send is matched_request, receive is new_request
211+ // Matched request is mapped to send_ref, new request is mapped to receive_ref
214212 log:: info!( "Payload mapping: send(id={}) receives payload from new(id={}), receive(id={}) receives payload from matched(id={})" ,
215213 send_ref. id, new_request_id, receive_ref. id, matched_request_id) ;
216214 ( new_request_payload, matched_request_payload)
0 commit comments