File tree Expand file tree Collapse file tree 4 files changed +5
-6
lines changed
Expand file tree Collapse file tree 4 files changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -621,7 +621,7 @@ void AsyncConnection::fault()
621621}
622622
623623void AsyncConnection::_stop () {
624- writeCallback. reset () ;
624+ writeCallback = {} ;
625625 dispatch_queue->discard_queue (conn_id);
626626 async_msgr->unregister_conn (this );
627627 worker->release_worker ();
@@ -737,8 +737,7 @@ void AsyncConnection::handle_write_callback() {
737737 recv_start_time = ceph::mono_clock::now ();
738738 write_lock.lock ();
739739 if (writeCallback) {
740- auto callback = *writeCallback;
741- writeCallback.reset ();
740+ auto callback = std::move (writeCallback);
742741 write_lock.unlock ();
743742 callback (0 );
744743 return ;
Original file line number Diff line number Diff line change @@ -223,7 +223,7 @@ class AsyncConnection : public Connection {
223223
224224 std::unique_ptr<Protocol> protocol;
225225
226- std::optional<std:: function<void (ssize_t )> > writeCallback;
226+ std::function<void (ssize_t )> writeCallback;
227227 std::function<void (char *, ssize_t )> readCallback;
228228 std::optional<unsigned > pendingReadLen;
229229 char *read_buffer;
Original file line number Diff line number Diff line change @@ -1294,7 +1294,7 @@ void ProtocolV1::reset_recv_state()
12941294
12951295 // clean read and write callbacks
12961296 connection->pendingReadLen .reset ();
1297- connection->writeCallback . reset () ;
1297+ connection->writeCallback = {} ;
12981298
12991299 if (state > THROTTLE_MESSAGE && state <= READ_FOOTER_AND_DISPATCH &&
13001300 connection->policy .throttler_messages ) {
Original file line number Diff line number Diff line change @@ -266,7 +266,7 @@ void ProtocolV2::reset_recv_state() {
266266
267267 // clean read and write callbacks
268268 connection->pendingReadLen .reset ();
269- connection->writeCallback . reset () ;
269+ connection->writeCallback = {} ;
270270
271271 next_tag = static_cast <Tag>(0 );
272272
You can’t perform that action at this time.
0 commit comments