Logo Search packages:      
Sourcecode: pwlib version File versions  Download package

BOOL PIndirectChannel::Close (  )  [virtual, inherited]

Close the channel. This will detach itself from the read and write channels and delete both of them if they are auto delete.

Returns:
TRUE if the channel is closed.

Reimplemented from PChannel.

Reimplemented in PFTPClient, PSMTPClient, PPOP3Client, PRFC822Channel, and PSSLChannel.

Definition at line 761 of file pchannel.cxx.

Referenced by PRFC822Channel::Close(), PPOP3Client::Close(), PSMTPClient::Close(), PFTPClient::Close(), and PIndirectChannel::~PIndirectChannel().

{
  BOOL retval = TRUE;

  flush();

  channelPointerMutex.StartRead();

  if (readChannel != NULL)
    retval = readChannel->Close();

  if (readChannel != writeChannel && writeChannel != NULL)
    retval = writeChannel->Close() && retval;

  channelPointerMutex.EndRead();

  channelPointerMutex.StartWrite();

  PChannel * r = readChannel;
  PChannel * w = writeChannel;

  readChannel = NULL;
  writeChannel = NULL;

  if (readAutoDelete)
    delete r;

  if (r != w && writeAutoDelete)
    delete w;

  channelPointerMutex.EndWrite();

  return retval;
}


Generated by  Doxygen 1.6.0   Back to index