(DEFINE-FILE-INFO READTABLE "INTERLISP" PACKAGE "INTERLISP")
(FILECREATED "10-Mar-88 14:59:38" {ERINYES}<LISPUSERS>LYRIC>COURIERSERVEPATCH.;2 3329   

      changes to%:  (FNS \SPP.ESTABLISH)

      previous date%: " 9-Mar-88 16:56:49" {ERINYES}<LISPUSERS>LYRIC>COURIERSERVEPATCH.;1)


(* "
Copyright (c) 1988 by Xerox Corporation.  All rights reserved.
")

(PRETTYCOMPRINT COURIERSERVEPATCHCOMS)

(RPAQQ COURIERSERVEPATCHCOMS ((FNS \SPP.ESTABLISH \SPP.CREATE.CON) (DECLARE%: EVAL@COMPILE DONTCOPY (FILES (SOURCE) SPPDECLS)))
)
(DEFINEQ

(\SPP.ESTABLISH
(LAMBDA (INITCON XIP) (* ; "Edited 10-Mar-88 14:58 by bvm") (* ;;; "The arrival of XIP causes this SPP connection to be established.  Fix up state as appropriate") (PROG (CON INSTREAM NAME) (COND ((NOT (fetch SPPSERVERFLAG of INITCON)) (SETQ CON INITCON) (* ; "For user connection, need to update socket info, as server may have switched from a well-known socket to a private one.") (\BLT (LOCF (fetch SPPDESTNSADDRESS0 of CON)) (LOCF (fetch XIPSOURCENET of XIP)) \#WDS.NSADDRESS)) (T (* ;; "The connection was opened in server mode.  Create a new spp connection, and establish it to the remote side, spawning a new process") (COND ((\SPP.DUPLICATE.REQUEST XIP) (* ; "We've already spawned a server for this source") (RETURN))) (SETQ CON (\SPP.CREATE.CON)) (\BLT (LOCF (fetch SPPDESTNSADDRESS0 of CON)) (LOCF (fetch XIPSOURCENET of XIP)) \#WDS.NSADDRESS) (* ; "Fill in address of port that contacted us") (SETQ NAME (CONCAT (PROCESSPROP (fetch SPPPROCESS of INITCON) (QUOTE NAME)) (QUOTE +) (OCTALSTRING (fetch SPPSOURCESKT# of CON)))) (replace SPPATTENTIONFN of CON with (fetch SPPATTENTIONFN of INITCON)) (* ; "Copy some methods from the listener con") (replace SPPWHENCLOSEDFN of CON with (fetch SPPWHENCLOSEDFN of INITCON)) (replace SPPERRORHANDLER of CON with (fetch SPPERRORHANDLER of INITCON)))) (replace SPPDESTID of CON with (fetch (SPPXIP SOURCECONID) of XIP)) (replace SPPSYSPKT of CON with NIL) (* ; "Flush any cached sys packet, now out of date") (replace SPPESTABLISHEDP of CON with T) (replace SPPSTATE of CON with \SPS.OPEN) (replace SPPDESTINATIONKNOWN of CON with T) (if NAME then (* ; "Finally, get server going") (SETQ INSTREAM (\SPP.CREATE.STREAMS CON)) (\SPP.CREATE.WATCHER CON NAME) (WITH.MONITOR (fetch SPPLOCK of CON) (* ; "Have to reply to the sender so he knows our id & socket") (\SPP.PROBE CON)) (ADD.PROCESS (LIST (fetch SPPSERVERFN of INITCON) INSTREAM (SPPOUTPUTSTREAM INSTREAM)) (QUOTE AFTEREXIT) (QUOTE DELETE))) (NOTIFY.EVENT (fetch SPPINPUTEVENT of CON))))
)

(\SPP.CREATE.CON
(LAMBDA (SKT#) (* ; "Edited  9-Mar-88 16:00 by bvm") (* ;; "Creates an SPPCON object, initialized to be a connection from this machine, etc.  If SKT# is specified, we open that exact socket, else a random user socket.") (LET* ((NSOC (OPENNSOCKET SKT#)) (CON (create SPPCON SPPXIPLENGTH ← (+ \XIPOVLEN \SPPHEAD.LENGTH) SPPXIPTYPE ← \XIPT.SPP SPPSOURCEID ← (LOGOR 32768 (LOGAND (DAYTIME) 32767)) SPPMYNSOCKET ← NSOC SPPSOURCESKT# ← (NSOCKETNUMBER NSOC) SPPACCEPTNO ← \SPP.INITIAL.ALLOCATION))) (\BLT (LOCF (fetch SPPSOURCENSADDRESS0 of CON)) \MY.NSADDRESS (SUB1 \#WDS.NSADDRESS)) CON))
)
)
(DECLARE%: EVAL@COMPILE DONTCOPY 
(FILESLOAD (SOURCE) SPPDECLS)
)
(PUTPROPS COURIERSERVEPATCH COPYRIGHT ("Xerox Corporation" 1988))
(DECLARE%: DONTCOPY
  (FILEMAP (NIL (540 3174 (\SPP.ESTABLISH 550 . 2564) (\SPP.CREATE.CON 2566 . 3172)))))
STOP