Revision b6b8c19a ml.c

View differences:

ml.c
708 708
		recvdatabuf[recv_id]->monitoringDataHeaderLen = msg_h->len_mon_data_hdr;
709 709
		recvdatabuf[recv_id]->bufsize = msg_h->msg_length + msg_h->len_mon_data_hdr;
710 710
		recvdatabuf[recv_id]->recvbuf = (char *) malloc(recvdatabuf[recv_id]->bufsize);
711
		recvdatabuf[recv_id]->arrivedBytes = 0;	//count this without the Mon headers
711 712
		/*
712 713
		* read the timeout data and set it
713 714
		*/
......
728 729
	if (msg_h->offset == 0) {
729 730
		memcpy(recvdatabuf[recv_id]->recvbuf, msgbuf, msg_h->len_mon_data_hdr);
730 731
		msgbuf += msg_h->len_mon_data_hdr;
732
		bufsize -= msg_h->len_mon_data_hdr;
731 733
		recvdatabuf[recv_id]->firstPacketArrived = 1;
732 734
	}
733 735

  
......
741 743
	memcpy(recvdatabuf[recv_id]->recvbuf + msg_h->len_mon_data_hdr + msg_h->offset, msgbuf, bufsize);
742 744

  
743 745
	//TODO very basic checkif all fragments arrived: has to be reviewed
744
	if(recvdatabuf[recv_id]->arrivedBytes == recvdatabuf[recv_id]->bufsize)
746
	if(recvdatabuf[recv_id]->arrivedBytes == recvdatabuf[recv_id]->bufsize - recvdatabuf[recv_id]->monitoringDataHeaderLen)
745 747
		recvdatabuf[recv_id]->status = COMPLETE; //buffer full -> msg completly arrived
746 748
	else
747 749
		recvdatabuf[recv_id]->status = ACTIVE;
......
779 781

  
780 782
				recv_params rParams;
781 783

  
782
				rParams.nrMissingBytes = recvdatabuf[recv_id]->bufsize - recvdatabuf[recv_id]->arrivedBytes;
784
				rParams.nrMissingBytes = recvdatabuf[recv_id]->bufsize - recvdatabuf[recv_id]->monitoringDataHeaderLen - recvdatabuf[recv_id]->arrivedBytes;
783 785
				rParams.recvFragments = recvdatabuf[recv_id]->recvFragments;
784 786
				rParams.msgtype = recvdatabuf[recv_id]->msgtype;
785 787
				rParams.connectionID = recvdatabuf[recv_id]->connectionID;

Also available in: Unified diff