chenBright commented on code in PR #2547: URL: https://github.com/apache/brpc/pull/2547#discussion_r1529605268
########## src/brpc/socket.cpp: ########## @@ -307,33 +307,56 @@ const uint32_t MAX_PIPELINED_COUNT = 16384; struct BAIDU_CACHELINE_ALIGNMENT Socket::WriteRequest { static WriteRequest* const UNCONNECTED; - + butil::IOBuf data; WriteRequest* next; bthread_id_t id_wait; - Socket* socket; + + void clear_and_set_control_bits(bool notify_on_success, + bool shutdown_write) { + _socket_and_control_bits.set_extra( + (uint16_t)notify_on_success << 1 | (uint16_t)shutdown_write); + } + + void set_socket(Socket* s) { + _socket_and_control_bits.set(s); + } + + // If this field is set to true, notify when write successfully. + bool is_notify_on_success() const { + return _socket_and_control_bits.extra() & ((uint16_t)1 << 1); + } + + // Whether shutdown write of the socket after this write complete. + bool need_shutdown_write() const { + return _socket_and_control_bits.extra() & (uint16_t)1; + } + + Socket* get_socket() const { + return _socket_and_control_bits.get(); + } uint32_t pipelined_count() const { - return (_pc_and_udmsg >> 48) & 0x3FFF; + return _pc_and_udmsg.extra() & 0x3FFF; } uint32_t get_auth_flags() const { - return (_pc_and_udmsg >> 62) & 0x03; + return (_pc_and_udmsg.extra() >> 14) & 0x03; } void clear_pipelined_count_and_auth_flags() { - _pc_and_udmsg &= 0xFFFFFFFFFFFFULL; + _pc_and_udmsg.reset_ptr_and_extra(); Review Comment: done ########## src/brpc/socket.h: ########## @@ -917,6 +994,8 @@ friend void DereferenceSocket(Socket*); // Storing data that are not flushed into `fd' yet. butil::atomic<WriteRequest*> _write_head; + bool _is_wirte_shutdown; Review Comment: done -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org For additional commands, e-mail: dev-h...@brpc.apache.org