piserial should be fixed
This commit is contained in:
@@ -714,10 +714,7 @@ ssize_t PIEthernet::readDevice(void * read_to, ssize_t max_size) {
|
||||
PRIVATE->addr_.sin_len = sizeof(PRIVATE->addr_);
|
||||
#endif
|
||||
//piCout << "connect to " << path() << "...";
|
||||
bool was_block_read_flag = blockingReadFlag();
|
||||
setBlockingReadFlag(true);
|
||||
connected_ = (::connect(sock, (sockaddr * )&(PRIVATE->addr_), sizeof(PRIVATE->addr_)) == 0);
|
||||
setBlockingReadFlag(was_block_read_flag);
|
||||
//piCout << "connect to " << path() << connected_;
|
||||
if (!connected_)
|
||||
piCoutObj << "Can`t connect to" << addr_r << "," << ethErrorString();
|
||||
|
||||
@@ -341,16 +341,6 @@ PIIODevice * PIIODevice::newDeviceByPrefix(const char * prefix) {
|
||||
}
|
||||
|
||||
|
||||
bool PIIODevice::blockingReadFlag() const {
|
||||
return reading_now;
|
||||
}
|
||||
|
||||
|
||||
void PIIODevice::setBlockingReadFlag(bool yes) {
|
||||
reading_now = yes;
|
||||
}
|
||||
|
||||
|
||||
void PIIODevice::read_func() {
|
||||
if (!isReadable()) {
|
||||
read_thread.stop();
|
||||
|
||||
@@ -528,15 +528,15 @@ protected:
|
||||
virtual void threadedReadBufferSizeChanged() {;}
|
||||
|
||||
static PIIODevice * newDeviceByPrefix(const char * prefix);
|
||||
bool blockingReadFlag() const;
|
||||
void setBlockingReadFlag(bool yes);
|
||||
|
||||
|
||||
bool isThreadedReadStopping() const {return read_thread.isStopping();}
|
||||
|
||||
DeviceMode mode_;
|
||||
DeviceOptions options_;
|
||||
ReadRetFunc func_read = nullptr;
|
||||
bool opened_ = false;
|
||||
void * ret_data_ = nullptr;
|
||||
std::atomic_bool reading_now;
|
||||
|
||||
private:
|
||||
EVENT_HANDLER(void, read_func);
|
||||
@@ -554,7 +554,6 @@ private:
|
||||
PIQueue<PIPair<PIByteArray, ullong> > write_queue;
|
||||
ullong tri = 0;
|
||||
uint threaded_read_buffer_size, reopen_timeout = 1000;
|
||||
std::atomic_bool reading_now;
|
||||
bool reopen_enabled = true;
|
||||
|
||||
static PIMutex nfp_mutex;
|
||||
|
||||
@@ -680,7 +680,7 @@ bool PISerial::openDevice() {
|
||||
|
||||
|
||||
bool PISerial::closeDevice() {
|
||||
if (isThreadedRead()) {
|
||||
if (isThreadedRead() && !isThreadedReadStopping()) {
|
||||
stopThreadedRead();
|
||||
}
|
||||
if (fd != -1) {
|
||||
|
||||
Reference in New Issue
Block a user