Revision 6f256447

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
tests/echoServer.c
129 129
      unsigned char msgtype = 12;
130 130
      int connectionID = 0;
131 131
      //strcpy(buffer, "Message for peer 2 \n");
132
      send_params sParams;
133 132
  
134
      mlSendData(connectionID,buffer,size,msgtype,&sParams);
133
      mlSendData(connectionID,buffer,size,msgtype,NULL);
135 134

  
136 135
}
137 136

  
......
166 165
  int bufsize = sizeof(buf);
167 166
  unsigned char msgtype = 13;
168 167
  int connectionID = 0;
169
  send_params sParams;
170 168

  
171 169
  fprintf(stderr,"The buffersize is %i\n",bufsize);
172 170
  if (result != lSize){ fprintf(stderr,"Could not read file!\n");  }
173 171
  else { printf("The size of the file is %ld \n",lSize); }
174 172
  
175
  mlSendData(connectionID,buf,(int)lSize,msgtype,&sParams);
173
  mlSendData(connectionID,buf,(int)lSize,msgtype,NULL);
176 174

  
177 175
}
178 176

  
......
217 215
  */
218 216
void open_connection_cb(int fd, short event,void *arg){
219 217

  
220
  int con_id = mlOpenConnection(rm_socketID,&receive_conn_cb,&connection_argument); ///< try to open a connection to another peer.
218
  send_params defaultSendParams;
219
  int con_id = mlOpenConnection(rm_socketID,&receive_conn_cb,&connection_argument, defaultSendParams); ///< try to open a connection to another peer.
221 220
  ///If the result is zero the event is resheduled into the event list.
222 221
  if(con_id < 0){
223 222

  
......
353 352
    char buffer[size];
354 353
    memset(buffer,'a',size);
355 354
    int connectionID = 0;
356
    send_params sParams;
357 355

  
358
    mlSendData(connectionID,buffer,size,msgtype,&sParams);
356
    mlSendData(connectionID,buffer,size,msgtype,NULL);
359 357

  
360 358
  }
361 359
  
transmissionHandler.h
168 168
  bool internal_connect; ///< set to true if a connection to the internall address could be established
169 169
  struct receive_connection_cb_list *connection_head;
170 170
  struct receive_connection_cb_list *connection_last;
171
  send_params defaultSendParams;
171 172
} connect_data;
172 173

  
173 174
#define ML_CON_MSG 127

Also available in: Unified diff