apache / brpc

brpc is an Industrial-grade RPC framework using C++ Language, which is often used in high performance system such as Search, Storage, Machine learning, Advertisement, Recommendation etc. "brpc" means "better RPC".
https://brpc.apache.org
Apache License 2.0
16.41k stars 3.96k forks source link

socket: fix potential double close #2663

Closed BusyJay closed 3 months ago

BusyJay commented 3 months ago

What problem does this PR solve?

Problem Summary:

_fd should be reset if ResetFileDescriptor is going to return -1, otherwise the fd will be closed in callers like CheckConnectedAndKeepWrite or Server::StartInernal and socket lifecycle methods like BeforeRecycled or WaitAndReset.

What is changed and the side effects?

Changed:

Side effects:

wwbmmm commented 3 months ago

LGTM