home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-07-03 | 1.3 KB | 66 lines | [TEXT/MPCC] |
- /*
- ** CTCPSessionDoc.cp
- **
- ** TurboTCP support library
- ** TCP session document
- **
- ** Copyright © 1993-94, FrostByte Design / Eric Scouten
- **
- */
-
-
- #include "CTCPSessionDoc.h"
-
-
- // —— closing windows & sessions ——
-
- /*______________________________________________________________________
- **
- ** Close
- **
- ** Respond to user close. Ensure that the TCP stream is gracefully closed. (This method is
- ** also called if the remote host closes the session or the session is terminated.)
- **
- ** quitting (Boolean): TRUE if quitting
- **
- ** return (Boolean): FALSE if close/quit aborted by user
- **
- */
-
- Boolean CTCPSessionDoc::Close(Boolean quitting)
-
- {
- closeAndQuit = quitting; // do we really want to close?
- if (!ConfirmClose(quitting))
- return FALSE;
-
- if (itsFile) // close file first
- itsFile->Close();
-
- if (!LocalClose(quitting)) // now close stream
- return FALSE;
-
- return CDirector::Close(quitting);
-
- }
-
-
- /*______________________________________________________________________
- **
- ** RemoteClose
- **
- ** Respond to notification that the remote host cancelled the session (either by normal
- ** close or terminate).
- **
- */
-
- void CTCPSessionDoc::RemoteClose()
-
- {
- Boolean sessionWasEstablished = SessionEstablished();
-
- CTCPEndpoint::RemoteClose();
- if ((goAwayOnClose) && (!sessionWasEstablished))
- Close(FALSE);
- }
-