kopia lustrzana https://gitlab.com/eliggett/wfview
Add keepalive for linux/mac pty
rodzic
2c5f37d06c
commit
4cb16b105f
|
@ -73,6 +73,9 @@ void pttyHandler::openPort()
|
|||
// we're good!
|
||||
qInfo(logSerial()) << "Opened pseudoterminal, slave name :" << ptsname(ptfd);
|
||||
|
||||
// Open the slave device to keep alive.
|
||||
ptKeepAlive = open(ptsnamd(ptfd), O_RDONLY);
|
||||
|
||||
ptReader = new QSocketNotifier(ptfd, QSocketNotifier::Read, this);
|
||||
connect(ptReader, &QSocketNotifier::activated,
|
||||
this, &pttyHandler::receiveDataIn);
|
||||
|
@ -283,6 +286,10 @@ void pttyHandler::closePort()
|
|||
{
|
||||
QFile::remove(portName);
|
||||
}
|
||||
|
||||
if (ptKeepAlive > 0) {
|
||||
close(ptKeepAlive);
|
||||
}
|
||||
#endif
|
||||
isConnected = false;
|
||||
}
|
||||
|
|
|
@ -62,6 +62,7 @@ private:
|
|||
bool rolledBack;
|
||||
|
||||
int ptfd; // pseudo-terminal file desc.
|
||||
int ptKeepAlive=0; // Used to keep the pty alive after client disconects.
|
||||
bool havePt;
|
||||
QString ptDevSlave;
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue