Revision 6214e30a

View differences:

ml.c
199 199
}
200 200

  
201 201

  
202
int connection_Exist(socketID_handle socketID){
202
int connection_Exist(socketID_handle socketID, bool ready){
203 203

  
204
  return connection_exist(socketID);
204
  return connection_exist(socketID,ready);
205 205

  
206 206
}
207 207

  
transmissionHandler.c
375 375

  
376 376
	// check if that connection already exist
377 377

  
378
	con_id = connection_exist(external_socketID);
378
	con_id = connection_exist(external_socketID, false);
379 379
	if (con_id >= 0) {
380 380
		// if so check if it is ready to use	
381 381
		if (connectbuf[con_id]->status == READY) {
......
1793 1793
}
1794 1794

  
1795 1795

  
1796
int connection_exist(socketID_handle socketID) {
1796
int connection_exist(socketID_handle socketID, bool ready) {
1797 1797
    /*
1798 1798
     * check if another connection for the external connectionID exist
1799 1799
     * that was established \ within the last 2 seconds
......
1801 1801
	int i;
1802 1802
	for (i = 0; i < CONNECTBUFSIZE; i++)
1803 1803
		if (connectbuf[i] != NULL)
1804
			if (compare_socketIDs(&(connectbuf[i]->external_socketID), socketID) == 0)
1804
			if (compare_socketIDs(&(connectbuf[i]->external_socketID), socketID) == 0) {
1805
				if (ready) return (connectbuf[i]->status == READY ? i : -1);;
1805 1806
				return i;
1807
				}
1806 1808

  
1807 1809
    return -1;
1808 1810
}
transmissionHandler.h
457 457
/**
458 458
 * A funtion that returns the whenever a connection is ready to use or not.
459 459
 * @param socketID A remote socketID to which the connection has been established.
460
 * @param ready if true,return the connID for READY connections only
460 461
 * @return -1 if the connection does not exist and the connection ID if it exists.
461 462
 */
462
int connection_exist(socketID_handle socketID);
463
int connection_exist(socketID_handle socketID,bool ready);
463 464

  
464 465
/**
465 466
 * Resolve a hostname to an unsigned long ready to be loaded into struct in_addr.s_addr

Also available in: Unified diff