Demo entry 6166059

aaaaaaaaaaaa

   

Submitted by anonymous on Oct 07, 2016 at 09:01
Language: ABAP. Code size: 678 Bytes.

int FindAvailableLink(int &link, vector<LinkMaster *> &LM)
{
	switch(LINK_PRIORITY) {
		case ROUND_ROBIN:
			if(++link >= NUM_LINKS)
				link=0;
			return link;
			break;
		case BUFFER_AWARE:
			unsigned minBufferSize = MAX_LINK_BUF;
			unsigned minBufferLink = 0;
			for(int l=0; l<NUM_LINKS; l++) {
				int bufSizeTemp = LM[l]->Buffers.size();
				for(int i=0; i<LM[l]->linkRxTx.size(); i++) {
					if(LM[l]->linkRxTx[i] != NULL) {
						bufSizeTemp += LM[l]->linkRxTx[i]->LNG;
					}
				}
				if(bufSizeTemp < minBufferSize) {
					minBufferSize = bufSizeTemp;
					minBufferLink = l;
				}
			}
			return minBufferLink;
			break;
	}
	return -1;
}

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).