;;; -*- Mode:Lisp; Readtable:ZL; Package:USER; Base:10; Patch-File:T -*-
;;; Patch file for System version 123.95
;;; Reason:
;;;  When the Flush Free File Connections process chooses an FTP Host Unit to reset,
;;;  it closes the control connection and :frees the host-unit -- without having
;;;  :reserved the host-unit.  Someone else can come along and grab it and end up
;;;  with an unreserved host-unit with a closed control connection...
;;;  Fix: :reserve the dormant host unit.
;;; Written 4-Nov-87 16:45:43 by pld at site LMI Cambridge
;;; while running on Jack Flanders from band 2
;;; with Experimental System 123.94, Experimental Local-File 73.0, Experimental FILE-Server 22.0, Experimental Unix-Interface 11.0, Experimental Tape 18.0, Experimental KERMIT 34.0, Experimental ZMail 71.0, Experimental Lambda-Diag 15.0, microcode 1754, SDU Boot Tape 3.12, SDU ROM 8.



; From modified file DJ: L.NETWORK.IP-TCP.USER; FTP-ACCESS.LISP#35 at 4-Nov-87 16:47:32
#10R FILE-SYSTEM#: 
(COMPILER-LET ((*PACKAGE* (PKG-FIND-PACKAGE "FILE-SYSTEM")))
  (COMPILER::PATCH-SOURCE-FILE "SYS: NETWORK; IP-TCP; USER; FTP-ACCESS  "

(defmethod (ftp-host-unit :dormant-reset) ()
  (cond ((send self :reserved-p))		;If someone has it reserved, not dormant
	(file-stream)				;or if there is an open file-stream
	((not (send self :dormant-p)))		;or it hasn't been dormant long enough
	((send self :reserve)			;otherwise, reserve host-unit
	 (unwind-protect
	     (send self :close-control-connection)	;And close the control connection
	   (send self :free)))
	(t nil)))				;Someone else grabbed it -- no longer dormant

))
