;;; -*- Mode:Lisp; Readtable:CL; Package:USER; Base:10; Patch-File:T -*-
;;; Patch file for System version 123.126
;;; Reason:
;;;  If the network is deconfigured before a full-gc, clear special variables that
;;;  refer to network data structures so that they can be reclaimed.
;;; Written 30-Nov-87 09:06:43 by pld at site Gigamos Cambridge
;;; while running on Jack Flanders from band 2
;;; with Experimental System 123.124, Experimental Local-File 73.3, Experimental FILE-Server 22.1, 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.KERNEL; CONFIGURE.LISP#86 at 30-Nov-87 09:06:44
#10R NETWORK#: 
(COMPILER-LET ((*PACKAGE* (GLOBAL:PKG-FIND-PACKAGE "NETWORK")))
  (COMPILER::PATCH-SOURCE-FILE "SYS: NETWORK; KERNEL; CONFIGURE  "

(defun maybe-deconfigure-network ()
  (setq *network-deconfigured-before-gc* nil)
  (when (and (boundp '*loopback-interface*)
	     *loopback-interface*
	     (ni-enabled *loopback-interface*))
    (format *query-io* "~&    Deconfiguring the network will allow garbage collection to reclaim network objects.~%")
    (when (global:with-timeout ((* 30 60.) (progn (write-string "Yes (after timeout)" *query-io*) t))
	    (yes-or-no-p "        Deconfigure network (Yes after thirty seconds) ? "))
      (setq *network-deconfigured-before-gc* t)
      (net:deconfigure)))
  (unless (and (boundp '*loopback-interface*)
	       *loopback-interface*
	       (ni-enabled *loopback-interface*))
    (chaos:reset nil)
    (setq chaos:made-pkts nil)
    (setq chaos:pkts-made 0)
    (setq chaos:free-pkts nil)
    (setq chaos:los-pkts nil)
    (setq chaos:current-los-pkt-count 0)
    (setq ethernet:*3com-ethernet-interface* nil)
    (setq ethernet:*excelan-ethernet-interface* nil)
    (setq ethernet:explorer-ethernet-interface nil)
    (setq chaos:cadr-network-interface nil)
    (setq si:share-interface nil)
    (setq net:*loopback-interface* nil)
    (setq arp:*arp-stream* nil)
    (setq chaos:*chaos-stream* nil)
    (setq ip:*ip-stream* nil)
    (setq tcp:*tcp-stream* nil)
    (setq udp:*udp-stream* nil)
    (setq icmp:*icmp-stream* nil)
    ))

))
