aboutsummaryrefslogtreecommitdiffstats
path: root/ncpd
diff options
context:
space:
mode:
authorFritz Elfert <felfert@to.com>2002-03-16 23:47:43 +0000
committerFritz Elfert <felfert@to.com>2002-03-16 23:47:43 +0000
commit69980a9469f5a2567239ea6389eca6adb77295bc (patch)
tree5874735ed534f5358e1c09ab5f5bbd21554edea5 /ncpd
parent193af441a127a0daabbd17c512e34817ddbcadfd (diff)
downloadplptools-69980a9469f5a2567239ea6389eca6adb77295bc.tar.gz
plptools-69980a9469f5a2567239ea6389eca6adb77295bc.tar.bz2
plptools-69980a9469f5a2567239ea6389eca6adb77295bc.zip
- ncpd: Now it's possible to change Series3/5 without restarting ncpd
Diffstat (limited to 'ncpd')
-rw-r--r--ncpd/link.cc5
-rw-r--r--ncpd/ncp.cc10
-rw-r--r--ncpd/packet.cc10
3 files changed, 19 insertions, 6 deletions
diff --git a/ncpd/link.cc b/ncpd/link.cc
index 025e131..19f7094 100644
--- a/ncpd/link.cc
+++ b/ncpd/link.cc
@@ -98,7 +98,6 @@ retransTimeout()
void Link::
reset() {
- p->reset();
txSequence = 1;
rxSequence = -1;
failed = false;
@@ -108,7 +107,7 @@ reset() {
purgeAllQueues();
for (int i = 0; i < 256; i++)
xoff[i] = false;
-
+ p->reset();
// submit a link request
sendReqReq();
}
@@ -335,6 +334,7 @@ receive(bufferStore buff)
rxSequence = 0;
txSequence = 1;
purgeAllQueues();
+ p->setEpoc(false);
if (verbose & LNK_DEBUG_LOG)
cout << "Link: 1-linkType set to " << linkType << endl;
}
@@ -444,6 +444,7 @@ receive(bufferStore buff)
rxSequence = 0;
txSequence = 1; // Our ReqReq was seq 0
purgeAllQueues();
+ p->setEpoc(false);
sendAck(rxSequence);
}
}
diff --git a/ncpd/ncp.cc b/ncpd/ncp.cc
index f20ca75..1780826 100644
--- a/ncpd/ncp.cc
+++ b/ncpd/ncp.cc
@@ -257,6 +257,16 @@ decodeControlMessage(bufferStore & buff)
cout << "ncp: REJECT client connect" << endl;
}
controlChannel(localChan, NCON_MSG_CONNECT_RESPONSE, b);
+
+ // Create linkchan if it does not yet exist
+ if (!lChan) {
+ if (verbose & NCP_DEBUG_LOG)
+ cout << "ncp: new active linkChan" << endl;
+ channelPtr[localChan] =
+ lChan = new linkChan(this, -1);
+ lChan->setVerbose(verbose);
+ }
+
}
break;
diff --git a/ncpd/packet.cc b/ncpd/packet.cc
index 1d3183b..b08b745 100644
--- a/ncpd/packet.cc
+++ b/ncpd/packet.cc
@@ -201,6 +201,7 @@ packet::
{
if (fd != -1) {
pthread_cancel(datapump);
+ pthread_join(datapump, NULL);
ser_exit(fd);
}
fd = -1;
@@ -212,8 +213,10 @@ packet::
void packet::
reset()
{
- if (fd != -1)
+ if (fd != -1) {
pthread_cancel(datapump);
+ pthread_join(datapump, NULL);
+ }
outRead = outWrite = 0;
internalReset();
if (fd != -1)
@@ -229,7 +232,7 @@ internalReset()
ser_exit(fd);
fd = -1;
}
- usleep(1000000);
+ usleep(100000);
inRead = inWrite = 0;
esc = false;
lastFatal = false;
@@ -499,13 +502,12 @@ linkFailed()
#endif
) {
failed = true;
- justStarted = true;
}
if ((verbose & PKT_DEBUG_LOG) && lastFatal)
cout << "packet: linkFATAL\n";
if ((verbose & PKT_DEBUG_LOG) && failed)
cout << "packet: linkFAILED\n";
- return lastFatal || failed;
+ return (lastFatal || failed);
}
/*