MCPcopy Create free account
hub / github.com/RangeNetworks/openbts / flush

Method flush

SGSNGGSN/LLC.cpp:509–555  ·  view source on GitHub ↗

If we have all the segments for pdu num, send it off. If force, delete it even if incomplete.

Source from the content-addressed store, hash-verified

507// If we have all the segments for pdu num, send it off.
508// If force, delete it even if incomplete.
509void Sndcp::flush(unsigned num, bool force)
510{
511 OneSdu *sp = &mSegs[num%sMemory];
512 unsigned i;
513 if (sp->mSegCount) { // We have received the final segment.
514 unsigned totsize = 0;
515 // Do we have all the segments yet?
516 for (i = 0; i < sp->mSegCount; i++) {
517 unsigned size = sp->segs[i].size();
518 if (size == 0) { break; } // failure.
519 totsize += size;
520 }
521 if (i == sp->mSegCount) { // success.
522 SNDCPDEBUG("flush"<<LOGVAR(num)<<LOGVAR(sp->mSegCount));
523 ByteVector result(totsize);
524 result.setAppendP(0);
525 for (i = 0; i < sp->mSegCount; i++) {
526 result.append(sp->segs[i]);
527 sp->segs[i].clear();
528 }
529 sp->mSegCount = 0;
530 //mPdp->pdpWriteLowSide(result);
531 getSgsnInfo()->sgsnSend2PdpLowSide(mNSapi,result);
532 //PdpContext *pdp = mlle->getSgsnInfo()->getPdp(mNSapi);
533 //assert(pdp);
534 //pdp->pdpWriteLowSide(result);
535 return;
536 }
537 SNDCPDEBUG("flush still pending"<<LOGVAR(num)<<LOGVAR(sp->mSegCount));
538 } else {
539 // Anything there at all? This is just for a message.
540 for (i = 0; i < 16; i++) {
541 if (sp->segs[i].size()) {
542 SNDCPDEBUG("flush still pending"<<LOGVAR(num)<<LOGVAR2("segment",i));
543 break;
544 }
545 }
546 }
547
548 if (force) {
549 // Delete all segments.
550 for (i = 0; i < 16; i++) {
551 sp->segs[i].clear();
552 }
553 sp->mSegCount = 0;
554 }
555}
556
557int Sndcp::diffSNS(int v1, int v2)
558{

Callers 1

commandLineFuncFunction · 0.80

Calls 5

setAppendPMethod · 0.80
sgsnSend2PdpLowSideMethod · 0.80
sizeMethod · 0.45
appendMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected