Revision 6f256447 ml.c

View differences:

ml.c
299 299

  
300 300
void send_conn_msg(int con_id, int buf_size, int command_type)
301 301
{
302
	send_params sparams;
303 302
	if(connectbuf[con_id]->ctrl_msg_buf == NULL)
304 303
		connectbuf[con_id]->ctrl_msg_buf = malloc(MAX);
305 304

  
......
315 314

  
316 315
	memcpy(&(msg_header->sock_id), loc_socketID, sizeof(socket_ID));
317 316

  
318
	send_msg(con_id, ML_CON_MSG, connectbuf[con_id]->ctrl_msg_buf, buf_size, true, &sparams);
317
	send_msg(con_id, ML_CON_MSG, connectbuf[con_id]->ctrl_msg_buf, buf_size, true, &(connectbuf[con_id]->defaultSendParams));
319 318
}
320 319

  
321 320
void
......
1237 1236
}
1238 1237

  
1239 1238
/* connection functions */
1240
int mlOpenConnection(socketID_handle external_socketID,receive_connection_cb connection_cb,void *arg){
1239
int mlOpenConnection(socketID_handle external_socketID,receive_connection_cb connection_cb,void *arg, const send_params defaultSendParams){
1241 1240

  
1242 1241
	int con_id;
1243 1242
	if (external_socketID == NULL) {
......
1257 1256

  
1258 1257
	con_id = mlConnectionExist(external_socketID, false);
1259 1258
	if (con_id >= 0) {
1259
		// overwrite defaultSendParams
1260
		connectbuf[con_id]->defaultSendParams = defaultSendParams;
1260 1261
		// if so check if it is ready to use
1261 1262
		if (connectbuf[con_id]->status == READY) {
1262 1263
				// if so use the callback immidiatley
......
1301 1302
			connectbuf[con_id]->connection_last->connection_cb = connection_cb;
1302 1303
			connectbuf[con_id]->connection_last->arg = arg;
1303 1304
			connectbuf[con_id]->external_connectionID = -1;
1305
			connectbuf[con_id]->defaultSendParams = defaultSendParams;
1304 1306
			break;
1305 1307
		}
1306 1308
	} //end of for
......
1335 1337

  
1336 1338
void mlSendData(const int connectionID,char *sendbuf,int bufsize,unsigned char msgtype,send_params *sParams){
1337 1339

  
1338
	if (sParams == NULL) {
1339
		error("ML: send data failed: send_params is a NULL ptr");
1340
		return;
1341
	}
1342

  
1343 1340
	if (connectionID < 0) {
1344 1341
		error("ML: send data failed: connectionID does not exist");
1345 1342
		return;
......
1354 1351
	    return;
1355 1352
	}
1356 1353

  
1354
	if (sParams == NULL) {
1355
		sParams = &(connectbuf[connectionID]->defaultSendParams);
1356
	}
1357

  
1357 1358
	send_msg(connectionID, msgtype, sendbuf, bufsize, false, sParams);
1358 1359

  
1359 1360
}
......
1361 1362
/* transmit data functions  */
1362 1363
int mlSendAllData(const int connectionID,send_all_data_container *container,int nr_entries,unsigned char msgtype,send_params *sParams){
1363 1364

  
1364

  
1365

  
1366

  
1367 1365
    if (nr_entries < 1 || nr_entries > 5) {
1368 1366

  
1369 1367
	printf

Also available in: Unified diff