X-Git-Url: http://plrg.eecs.uci.edu/git/?p=folly.git;a=blobdiff_plain;f=folly%2Fio%2Fasync%2FAsyncSocket.h;h=6462f115d7a0a52e301195681f212fd65c972377;hp=4b0fd0695fc11b5a175ba0deff2261eb75ba9343;hb=4c7a736d6529f22451a0ec965e093e7e318695e3;hpb=d71b7361e718b3ee9ed720ae65f6223dbb9823a1 diff --git a/folly/io/async/AsyncSocket.h b/folly/io/async/AsyncSocket.h index 4b0fd069..6462f115 100644 --- a/folly/io/async/AsyncSocket.h +++ b/folly/io/async/AsyncSocket.h @@ -786,6 +786,13 @@ class AsyncSocket : virtual public AsyncTransportWrapper { evbChangeCb_ = std::move(cb); } + /** + * Attempt to cache the current local and peer addresses (if not already + * cached) so that they are available from getPeerAddress() and + * getLocalAddress() even after the socket is closed. + */ + void cacheAddresses(); + /** * writeReturn is the total number of bytes written, or WRITE_ERROR on error. * If no data has been written, 0 is returned. @@ -1123,6 +1130,9 @@ class AsyncSocket : virtual public AsyncTransportWrapper { std::string withAddr(const std::string& s); + void cacheLocalAddress() const; + void cachePeerAddress() const; + StateEnum state_; ///< StateEnum describing current state uint8_t shutdownFlags_; ///< Shutdown state (ShutdownFlags) uint16_t eventFlags_; ///< EventBase::HandlerFlags settings