func (h *fshandler) Close(sessionID [16]byte, request *xrdclose.Request) (xrdproto.Marshaler, xrdproto.ResponseStatus) {
	h.mu.RLock()
	sess, ok := h.sessions[sessionID]
	h.mu.RUnlock()
	if !ok {
		// This situation can appear if user tries to close without opening any file at all.
		return xrdproto.ServerError{
			Code:    xrdproto.InvalidRequest,
			Message: fmt.Sprintf("Invalid file handle: %v", request.Handle),
		}, xrdproto.Error
	}
	sess.mu.Lock()
	defer sess.mu.Unlock()
	file, ok := sess.handles[request.Handle]
	if !ok {
		return xrdproto.ServerError{
			Code:    xrdproto.InvalidRequest,
			Message: fmt.Sprintf("Invalid file handle: %v", request.Handle),
		}, xrdproto.Error
	}
	delete(sess.handles, request.Handle)
	err := file.Close()
	if err != nil {
		return xrdproto.ServerError{
			Code:    xrdproto.IOError,
			Message: fmt.Sprintf("An IO error occurred: %v", err),
		}, xrdproto.Error
	}
	return nil, xrdproto.Ok
}
// Close implements server.Handler.Close.
Close implements server.Handler.Close.
// Close implements server . Handler . Close .
func (h *fshandler) Close(sessionID [16]byte, request *xrdclose.Request) (xrdproto.Marshaler, xrdproto.ResponseStatus) {
	h.mu.RLock()
	sess, ok := h.sessions[sessionID]
	h.mu.RUnlock()
	if !ok {
		return xrdproto.ServerError{
			Code:    xrdproto.InvalidRequest,
			Message: fmt.Sprintf("Invalid file handle: %v", request.Handle),
		}, xrdproto.Error
	}
	sess.mu.Lock()
	defer sess.mu.Unlock()
	file, ok := sess.handles[request.Handle]
	if !ok {
		return xrdproto.ServerError{
			Code:    xrdproto.InvalidRequest,
			Message: fmt.Sprintf("Invalid file handle: %v", request.Handle),
		}, xrdproto.Error
	}
	delete(sess.handles, request.Handle)
	err := file.Close()
	if err != nil {
		return xrdproto.ServerError{
			Code:    xrdproto.IOError,
			Message: fmt.Sprintf("An IO error occurred: %v", err),
		}, xrdproto.Error
	}
	return nil, xrdproto.Ok
}
func ( h * fshandler ) Close ( sessionID [ 16 ] byte , request * xrdclose . Request ) ( xrdproto . Marshaler , xrdproto . ResponseStatus ) { h . mu . RLock ( ) sess , ok := h . sessions [ sessionID ] h . mu . RUnlock ( ) if ! ok { return xrdproto . ServerError { Code : xrdproto . InvalidRequest , Message : fmt . Sprintf ( " " , request . Handle ) , } , xrdproto . Error } sess . mu . Lock ( ) defer sess . mu . Unlock ( ) file , ok := sess . handles [ request . Handle ] if ! ok { return xrdproto . ServerError { Code : xrdproto . InvalidRequest , Message : fmt . Sprintf ( " " , request . Handle ) , } , xrdproto . Error } delete ( sess . handles , request . Handle ) err := file . Close ( ) if err != nil { return xrdproto . ServerError { Code : xrdproto . IOError , Message : fmt . Sprintf ( " " , err ) , } , xrdproto . Error } return nil , xrdproto . Ok }
Close implements server.Handler.Close.
Close implements server . Handler . Close .
// This situation can appear if user tries to close without opening any file at all.