code: func (m *model) Closed(conn protocol.Connection, err error) {
  	device := conn.ID()
  
  	m.pmut.Lock()
  	defer m.pmut.Unlock()
  	conn, ok := m.conn[device]
  	if !ok {
  		return
  	}
  	m.progressEmitter.temporaryIndexUnsubscribe(conn)
  	delete(m.conn, device)
  	delete(m.connRequestLimiters, device)
  	delete(m.helloMessages, device)
  	delete(m.deviceDownloads, device)
  	delete(m.remotePausedFolders, device)
  	closed := m.closed[device]
  	delete(m.closed, device)
  
  	l.Infof("Connection to %s at %s closed: %v", device, conn.Name(), err)
  	events.Default.Log(events.DeviceDisconnected, map[string]string{
  		"id":    device.String(),
  		"error": err.Error(),
  	})
  	close(closed)
  }
docs: // Closed is called when a connection has been closed