Revision: 34917
http://sourceforge.net/p/opalvoip/code/34917
Author: rjongbloed
Date: 2016-08-13 14:48:08 +0000 (Sat, 13 Aug 2016)
Log Message:
-----------
Small code tidy up, using normalised function on call when channel closed.
Modified Paths:
--------------
ptlib/branches/v2_16/src/ptlib/unix/channel.cxx
Modified: ptlib/branches/v2_16/src/ptlib/unix/channel.cxx
===================================================================
--- ptlib/branches/v2_16/src/ptlib/unix/channel.cxx 2016-08-13 14:43:22 UTC (rev 34916)
+++ ptlib/branches/v2_16/src/ptlib/unix/channel.cxx 2016-08-13 14:48:08 UTC (rev 34917)
@@ -77,6 +77,9 @@
PBoolean PChannel::PXSetIOBlock(PXBlockType type, const PTimeInterval & timeout)
{
+ if (CheckNotOpen())
+ return false;
+
ErrorGroup group;
switch (type) {
case PXReadBlock :
@@ -89,9 +92,6 @@
group = LastGeneralError;
}
- if (os_handle < 0)
- return SetErrorValues(NotOpen, EBADF, group);
-
PThread * blockedThread = PThread::Current();
{
@@ -160,8 +160,8 @@
{
lastReadCount = 0;
- if (os_handle < 0)
- return SetErrorValues(NotOpen, EBADF, LastReadError);
+ if (CheckNotOpen())
+ return false;
for (;;) {
PPROFILE_SYSTEM(
@@ -193,9 +193,8 @@
{
lastWriteCount = 0;
- // if the os_handle isn't open, no can do
- if (os_handle < 0)
- return SetErrorValues(NotOpen, EBADF, LastWriteError);
+ if (CheckNotOpen())
+ return false;
// flush the buffer before doing a write
IOSTREAM_MUTEX_WAIT();
@@ -317,9 +316,9 @@
PBoolean PChannel::Close()
{
- if (os_handle < 0)
- return SetErrorValues(NotOpen, EBADF);
-
+ if (CheckNotOpen())
+ return false;
+
return ConvertOSError(PXClose());
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|