Commit da655189 authored by Jonathon Duerig's avatar Jonathon Duerig

Revert odd CVS artifacts in PacketSensor.cc. Add namespace to new code in main.c

c. Add some logging and remove a complication from CircularTraffic.cc while it i
s under study for a bug.
parent 99b9f939
......@@ -37,12 +37,12 @@ Time CircularTraffic::addWrite(TrafficWriteCommand const & newWrite,
Time const & deadline)
{
Time now = getCurrentTime();
if (! writes.empty() && newWrite.delta == 0)
{
writes.back().size += newWrite.size;
}
else
{
// if (! writes.empty() && newWrite.delta == 0)
// {
// writes.back().size += newWrite.size;
// }
// else
// {
writes.push_back(newWrite);
writes.back().localTime = now;
// XXX: end() is not necessarily a constant value. Though this
......@@ -52,7 +52,7 @@ Time CircularTraffic::addWrite(TrafficWriteCommand const & newWrite,
{
current = writes.begin();
}
}
// }
if (deadline == Time())
{
// If there is no current deadline, return the next one.
......
......@@ -221,9 +221,10 @@ int KernelTcp::writeMessage(int size, WriteResult & result)
for (bytesToWrite = size; bytesToWrite > 0; bytesToWrite -= MAX_WRITESIZE) {
int writeSize = min(MAX_WRITESIZE,bytesToWrite);
// Actually write the darn thing.
logWrite(CONNECTION_MODEL, "About to write %d bytes", writeSize);
int error = send(peersock, &buffer[0], writeSize, 0);
logWrite(CONNECTION_MODEL,"Tried to write %d bytes, actually wrote %d",
writeSize, error);
logWrite(CONNECTION_MODEL,
"Tried to write %d bytes, actually wrote %d", writeSize, error);
if (error == 0)
{
......@@ -299,10 +300,10 @@ void KernelTcp::init(void)
// Set up the peerAccept socket
if (global::peerServerPort != 0) {
global::peerAccept = createServer(global::peerServerPort,
"Peer accept socket (No incoming peer "
"connections will be accepted)");
"Peer accept socket (No incoming peer "
"connections will be accepted)");
logWrite(PEER_CYCLE, "Created peer server on port %d",
global::peerServerPort);
global::peerServerPort);
}
// Set up the connectionModelExemplar
......
......@@ -173,40 +173,6 @@ void PacketSensor::localSend(PacketInfo * packet)
SentPacket record;
record.seqStart = startSequence;
<<<<<<< PacketSensor.cc
/*
* Calculate the packet payload size - we have to make sure to
* take into account IP and TCP option headers
*/
unsigned int sequenceLength =
// Total length of the IP part of the packet
(ntohs(packet->ip->ip_len))
// Total length of all IP headers (including options)
- (packet->ip->ip_hl*4)
// Total length of all TCP headers (including options)
<<<<<<< PacketSensor.cc
- (packet->tcp->doff*4);
record.seqEnd = record.seqStart + sequenceLength;
record.totalLength = packet->packetLength;
record.timestamp = packet->packetTime;
logWrite(SENSOR,
<<<<<<< PacketSensor.cc
"PacketSensor::localSend() new record: ss=%i,sl=%i,se=%i,tl=%i",
record.seqStart,record.sequenceLength,record.seqEnd,
record.totalLength);
=======
"PacketSensor::localSend() new record: ss=%u,sl=%u,se=%u,tl=%u",
record.seqStart, sequenceLength, record.seqEnd,
record.totalLength);
>>>>>>> 1.5
globalSequence.seqEnd = record.seqEnd;
if (unacked.empty())
{
globalSequence.seqStart = record.seqStart;
=======
- (packet->tcp->doff*4);
=======
>>>>>>> 1.27
// We want to get the sequence number of the last data byte, not the
// sequence number of the first byte of the next segment
record.seqEnd = record.seqStart + sequenceLength - 1;
......@@ -216,11 +182,6 @@ void PacketSensor::localSend(PacketInfo * packet)
"PacketSensor::localSend() new record: ss=%u,sl=%u,se=%u,tl=%u",
record.seqStart, sequenceLength, record.seqEnd,
record.totalLength);
<<<<<<< PacketSensor.cc
>>>>>>> 1.11
globalSequence.seqEnd = record.seqEnd;
=======
>>>>>>> 1.16
if (unacked.empty())
{
globalSequence.seqStart = record.seqStart;
......
......@@ -294,7 +294,7 @@ void processArgs(int argc, char * argv[])
}
break;
case 'L':
logFlags = ERROR & EXCEPTION;
global::logFlags = ERROR & EXCEPTION;
break;
case '?':
default:
......@@ -309,7 +309,7 @@ void init(void)
FD_ZERO(&global::readers);
global::maxReader = -1;
logInit(stderr, logFlags, true);
logInit(stderr, global::logFlags, true);
/*
* Install a signal handler so that we can catch control-C's, etc.
......@@ -379,16 +379,26 @@ void mainLoop(void)
{
timeUntilWrite = nextWrite->first - now;
waitPeriod = timeUntilWrite.getTimeval();
logWrite(MAIN_LOOP, "Before select, waitTime=%f",
timeUntilWrite.toDouble());
}
else
else if (nextWrite == schedule.end())
{
// otherwise we want to wait forever.
timeUntilWrite = Time();
waitPeriod = NULL;
logWrite(MAIN_LOOP, "Before select, waitTime=forever");
}
else
{
timeUntilWrite = Time();
waitPeriod = timeUntilWrite.getTimeval();
logWrite(MAIN_LOOP, "Before select, waitTime=zero");
}
int error = select(global::maxReader + 1, &readable, NULL, NULL,
// &debugTimeout);
waitPeriod);
logWrite(MAIN_LOOP, "After select");
if (error == -1)
{
switch (errno)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment