/** * Method to send the close frames * Returns true if object still exists * @return bool */ bool ConnectionImpl::sendClose() { // after the send operation the object could be dead Monitor monitor(this); // loop over all channels for (auto iter = _channels.begin(); iter != _channels.end(); iter++) { // close the channel iter->second->close(); // we could be dead now if (!monitor.valid()) return false; } // send the close frame send(ConnectionCloseFrame(0, "shutdown")); // leap out if object no longer is alive if (!monitor.valid()) return false; // we're in a new state _state = state_closing; // done return true; }
/** * Method to send the close frames * Returns true if object still exists * @return bool */ bool ConnectionImpl::sendClose() { // after the send operation the object could be dead Monitor monitor(this); // send the close frame send(ConnectionCloseFrame(0, "shutdown")); // leap out if object no longer is alive if (!monitor.valid()) return false; // we're in a new state _state = state_closing; // done return true; }