Skip to content

Commit e51ec04

Browse files
committed
sw: Fix move issues
1 parent 0e4eedb commit e51ec04

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/lib/SwAxi.cc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ std::future<Status> Master::read(Buffer *buffer) {
3434
txn.txn->address = buffer->address;
3535
txn.txn->size = buffer->size;
3636
txn.txn->ok = true;
37+
auto future = txn.promise.get_future();
3738
queue->push(std::move(txn));
38-
return txn.promise.get_future();
39+
return future;
3940
}
4041

4142
std::future<Status> Master::write(const Buffer *buffer) {
@@ -49,8 +50,9 @@ std::future<Status> Master::write(const Buffer *buffer) {
4950
txn.txn->data.resize(buffer->size);
5051
memcpy(txn.txn->data.data(), buffer->data, buffer->size);
5152
txn.txn->ok = true;
53+
auto future = txn.promise.get_future();
5254
queue->push(std::move(txn));
53-
return txn.promise.get_future();
55+
return future;
5456
}
5557

5658
void Master::terminate() {
@@ -234,7 +236,6 @@ void Bridge::reader() {
234236
}
235237

236238
Transaction *respTxn = new Transaction;
237-
;
238239
Slave *s = slaveMap[txn->target];
239240
int ret = 0;
240241
Buffer b = {.size = txn->size, .address = txn->address};
@@ -280,6 +281,7 @@ void Bridge::writer() {
280281
return;
281282
}
282283

284+
Transaction *t = txn.txn.get();
283285
if (txn.type == Master::TxnType::TERMINATION) {
284286
Status st = client->sendTermination(txn.txn->id);
285287
if (st.isError()) {
@@ -295,7 +297,7 @@ void Bridge::writer() {
295297
masterMap[txn.txn->initiator].txns[txn.txn->id] = std::move(txn);
296298
}
297299

298-
Status st = client->sendTransaction(*txn.txn);
300+
Status st = client->sendTransaction(*t);
299301
if (st.isError()) {
300302
writerStatus = st;
301303
return;

0 commit comments

Comments
 (0)