// Logout calls SessionManager.Logout for the given connection.
557448
func (connection *VSphereConnection) Logout(ctx context.Context) {
	clientLock.Lock()
	c := connection.Client
	clientLock.Unlock()
	if c == nil {
		return
	}

	m := session.NewManager(c)

	hasActiveSession, err := m.SessionIsActive(ctx)
	if err != nil {
		klog.Errorf("Logout failed: %s", err)
		return
	}
	if !hasActiveSession {
		klog.Errorf("No active session, cannot logout")
		return
	}
	if err := m.Logout(ctx); err != nil {
		klog.Errorf("Logout failed: %s", err)
	}
}
723970
func (cm *ConnManager) Disconnect(id uint64) {
	if atomic.LoadInt32(&cm.stop) != 0 {
		return
	}

	select {
	case cm.requests <- handleDisconnected{id, true}:
	case <-cm.quit:
	}
}
419387
func logoutButton(r *messenger.Response) error {
	buttons := &[]messenger.StructuredMessageButton{
		{
			Type: "account_unlink",
		},
	}
	return r.ButtonTemplate("Unlink your account.", buttons, messenger.ResponseType)
}
1003131
func (self *FSock) Disconnect() (err error) {
	self.fsMutex.Lock()
	if self.conn != nil {
		if self.logger != nil {
			self.logger.Info("<FSock> Disconnecting from FreeSWITCH!")
		}
		err = self.conn.Close()
		self.conn = nil
	}
	self.fsMutex.Unlock()
	return
}
1033917
func (auth *Auth) Logout(w http.ResponseWriter, r *http.Request) error {
	// Remove the session
	cookie, err := r.Cookie(auth.CookieName())
	if err != nil {
		return nil
	}
	auth.sessions.Delete(cookie.Value)

	// TODO Remove all sessions for this user? Global Logout?
	// TODO delete the cookie?

	http.Redirect(w, r, auth.homeURL, 302)
	return nil
}
462004
func (m UsersAPIAuthMethod) LogoutURL(c context.Context, dest string) (string, error) {
	return user.LogoutURL(c, dest)
}
902858
func restLogout(w *rest.ResponseWriter, r *rest.Request) {
	glog.V(2).Info("restLogout() called.")
	// Read session cookie and delete session
	cookie, err := r.Request.Cookie(sessionCookie)
	if err != nil {
		glog.V(2).Info("Unable to read session cookie")
	} else {
		deleteSessionT(cookie.Value)
		glog.V(2).Infof("Deleted session %s for explicit logout", cookie.Value)
	}

	// Blank out all login cookies
	writeBlankCookie(w, r, auth0TokenCookie)
	writeBlankCookie(w, r, sessionCookie)
	writeBlankCookie(w, r, usernameCookie)
	w.WriteJson(&simpleResponse{"Logged out", loginLink()})
}
1200953
func (c *DefaultClient) Disconnect() {
	if !c.IsConnected() {
		return
	}

	c.ctx.Debug("Disconnecting from AMQP")

	c.mutex.Lock()
	defer c.mutex.Unlock()
	for user, channel := range c.channels {
		channel.Close()
		delete(c.channels, user)
	}

	c.conn.Close()
	c.conn = nil
}
912789
func (tc *TeleportClient) LogoutAll() error {
	err := tc.localAgent.DeleteKeys()
	if err != nil {
		return trace.Wrap(err)
	}
	return nil
}
967666
func (c *Communicator) Disconnect() error {
	c.lock.Lock()
	defer c.lock.Unlock()

	if c.cancelKeepAlive != nil {
		c.cancelKeepAlive()
	}

	if c.config.sshAgent != nil {
		if err := c.config.sshAgent.Close(); err != nil {
			return err
		}
	}

	if c.conn != nil {
		conn := c.conn
		c.conn = nil
		return conn.Close()
	}

	return nil
}
1318432
func (s *Session) Logout(ctx context.Context) error {

	if !s.engine.session.HasToken() {
		return &apitypes.Error{
			Type: apitypes.UnauthorizedError,
			Err:  []string{"You must be logged in, to logout!"},
		}
	}

	tok := s.engine.session.Token()
	err := s.engine.client.Tokens.Delete(ctx, string(tok[:]))
	switch err := err.(type) {
	case *apitypes.Error:
		switch err.Type {
		case apitypes.InternalServerError:

			// On a 5XX response, we don't know for sure that the server
			// has successfully removed the auth token. Keep the copy in
			// the daemon, so the user may try again.
			return err
		case apitypes.NotFoundError, apitypes.BadRequestError, apitypes.UnauthorizedError:
			// A 4XX error indicates either the token isn't found, or we're
			// not allowed to remove it (or the server is a teapot).
			//
			// In any case, the daemon has gotten out of sync with the
			// server. Remove our local copy of the auth token.
			log.Printf("Got 4XX removing auth token. Treating as success")
			logoutErr := s.engine.session.Logout()
			if logoutErr != nil {
				return logoutErr
			}

			return nil
		}
	case nil:
		logoutErr := s.engine.session.Logout()
		if logoutErr != nil {
			return logoutErr
		}

		return nil
	default:
		return err
	}

	return nil
}
876914
func logOutputFunction(data unsafe.Pointer, category C.int, pri C.SDL_LogPriority, message *C.char) {
	ctx := (*logOutputFunctionCtx)(data)

	ctx.f(ctx.d, int(category), LogPriority(pri), C.GoString(message))
}
1018959
func (db *DB) Disconnect() error {
	if db.connection != nil {
		if err := db.connection.Close(); err != nil {
			return err
		}
		db.connection = nil
		db.cache = make(map[string]*sql.Stmt)
	}
	return nil
}
1111951
func (n *managedNode) Disconnect() error {
	n.Lock()
	defer n.Unlock()
	return n.conn.Close()
}
904154
func (d *DNSProvider) logout() error {
	if len(d.token) == 0 {
		// nothing to do
		return nil
	}

	url := fmt.Sprintf("%s/Session", defaultBaseURL)
	req, err := http.NewRequest(http.MethodDelete, url, nil)
	if err != nil {
		return err
	}
	req.Header.Set("Content-Type", "application/json")
	req.Header.Set("Auth-Token", d.token)

	resp, err := d.config.HTTPClient.Do(req)
	if err != nil {
		return err
	}
	resp.Body.Close()

	if resp.StatusCode != http.StatusOK {
		return fmt.Errorf("API request failed to delete session with HTTP status code %d", resp.StatusCode)
	}

	d.token = ""

	return nil
}
1157061
func (f *Form) Logout(ctx web.Context) error {
	c := &http.Cookie{
		Name:   f.CookieName,
		MaxAge: -1,
	}
	ctx.SetCookie(c)
	return ctx.Redirect(f.DefaultURL)
}
612356
func (s session) Close() error {
	if s.Connection == nil {
		return nil
	}
	return s.Connection.Close()
}