diff --git a/pelab/magent/CircularTraffic.cc b/pelab/magent/CircularTraffic.cc index e4958ff569ad4864df283543aec5cf374817d368..d319c215eede0c1e5bf361d9316cf8c2339f09fd 100644 --- a/pelab/magent/CircularTraffic.cc +++ b/pelab/magent/CircularTraffic.cc @@ -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. diff --git a/pelab/magent/KernelTcp.cc b/pelab/magent/KernelTcp.cc index a64b997ecdbcc1ef0ca265a18e35b27bbd004c61..798d2da6f8c55db793c3701c127c7a373a4221a4 100755 --- a/pelab/magent/KernelTcp.cc +++ b/pelab/magent/KernelTcp.cc @@ -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 diff --git a/pelab/magent/PacketSensor.cc b/pelab/magent/PacketSensor.cc index e7f5703e868990a19f2e395595410821048bd187..e8ab4d6bbba5cb4904c0aa4f28f28e46dbc2eb63 100644 --- a/pelab/magent/PacketSensor.cc +++ b/pelab/magent/PacketSensor.cc @@ -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; diff --git a/pelab/magent/main.cc b/pelab/magent/main.cc index 281d104c11e5dd2c4c0f64bced6bb0c5f3642c2d..938819cbc597b3a1d98b238a49f84e099954b65e 100755 --- a/pelab/magent/main.cc +++ b/pelab/magent/main.cc @@ -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)