Revision df781cb0 net_helper-ml.c

View differences:

net_helper-ml.c
16 16
#include "ml.h"
17 17
#include "ml_helpers.h"
18 18

  
19
#include "msg_types.h"/**/
20

  
19 21
/**
20 22
 * libevent pointer
21 23
 */
......
52 54
	uint8_t *data;
53 55
};
54 56
static struct receivedB receivedBuffer[NH_BUFFER_SIZE];
55
/**/ static int recv_counter =0;
57
/**/ static int recv_counter =0; static int snd_counter =0;
58

  
56 59

  
57 60
/**
58 61
 * Look for a free slot in the received buffer and allocates it for immediate use
......
178 181
	p = (msgData_cb *)arg;
179 182
	if (p == NULL) return;
180 183
	mlSendData(connectionID,(char *)(sendingBuffer[p->bIdx]),p->mSize,p->msgType,NULL);
181
///**/fprintf(stderr,"Sent message of type # %c and size %d\n",
182
//		((char*)sendingBuffer[p->bIdx])[0]+'0', p->mSize);
184
/**/char mt = ((char*)sendingBuffer[p->bIdx])[0]; ++snd_counter;
185
	if (mt!=MSG_TYPE_TOPOLOGY &&
186
		mt!=MSG_TYPE_CHUNK && mt!=MSG_TYPE_SIGNALLING) {
187
			fprintf(stderr,"Net-helper ERROR! Sent message # %d of type %c and size %d\n",
188
				snd_counter,mt+'0', p->mSize);}
183 189
	free(sendingBuffer[p->bIdx]);
184 190
	sendingBuffer[p->bIdx] = NULL;
185 191
//	fprintf(stderr,"Net-helper: Message # %d for connection %d sent!\n ", p->bIdx,connectionID);
......
200 206
		fprintf(stderr,"Net-helper: Connection %d could not be established to send msg %d.\n ", connectionID,p->bIdx);
201 207
		free(sendingBuffer[p->bIdx]);
202 208
		sendingBuffer[p->bIdx] = NULL;
203
		p->mSize = -1;
209
		free(p);//p->mSize = -1;
204 210
	}
205 211
	//	event_base_loopbreak(base);
206 212
}

Also available in: Unified diff