Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 181534
Collapse All | Expand All

(-)src-native-new/src/transport/TPTPAgentCompTL/AgentCTL.c (-3 / +33 lines)
Lines 26-31 Link Here
26
#include <stdio.h>
26
#include <stdio.h>
27
#ifdef _WIN32
27
#ifdef _WIN32
28
#include <io.h>
28
#include <io.h>
29
#else
30
#include "tptp/TPTPCommon.h"
29
#endif
31
#endif
30
32
31
/**
33
/**
Lines 111-117 Link Here
111
	if ( connectionEntry == NULL )
113
	if ( connectionEntry == NULL )
112
	{
114
	{
113
		/* Unrecognized connection */
115
		/* Unrecognized connection */
114
		TPTP_LOG_ERROR_MSG1( stateData, "ACTL cannot find connection entry for ID %ld", connectionID );
116
		TPTP_LOG_ERROR_MSG1( stateData, "ACTL cannot find connection entry for ID %d", connectionID );
115
		return -1;
117
		return -1;
116
	}
118
	}
117
119
Lines 122-128 Link Here
122
	{
124
	{
123
		/* Missing agent data */
125
		/* Missing agent data */
124
		ra_mutexExit( &actlData->processList->lock );
126
		ra_mutexExit( &actlData->processList->lock );
125
		TPTP_LOG_ERROR_MSG1( stateData, "ACTL cannot find agent data for ID %ld", connectionID );
127
		TPTP_LOG_ERROR_MSG1( stateData, "ACTL cannot find agent data for ID %d", connectionID );
126
		return -1;
128
		return -1;
127
	}
129
	}
128
130
Lines 306-311 Link Here
306
	return baseTL_startTransportListener( tlo, serveRequests );
308
	return baseTL_startTransportListener( tlo, serveRequests );
307
}
309
}
308
310
311
int clearProcesses() {
312
	process_list_t *plist;
313
	process_list_node_t *pnode;
314
	
315
	plist = ra_getActiveProcessList();
316
	if (plist == NULL) return 0;
317
318
	pnode = plist->head;
319
	while(pnode != NULL) {
320
		ra_processDestroy(pnode->process);
321
	
322
		pnode = pnode->next;
323
	}
324
	
325
	return 0;
326
}
327
309
/**
328
/**
310
 *********************************************************
329
 *********************************************************
311
 *
330
 *
Lines 319-325 Link Here
319
338
320
tptp_int32 stopTransportListener(tptp_object* tlo)
339
tptp_int32 stopTransportListener(tptp_object* tlo)
321
{
340
{
322
	return baseTL_stopTransportListener( tlo );
341
	tptp_int32 rc;
342
	char pipeName[_MAX_PATH];
343
344
	rc = baseTL_stopTransportListener(tlo);
345
346
	strcpy (pipeName, RAC_PIPE_NAMESPACE);
347
	strcat (pipeName, RAC_MASTER_ADDRESS);
348
349
	destroyNamedPipe(pipeName);	
350
	clearProcesses();
351
352
	return rc;
323
}
353
}
324
354
325
355
(-)src-native-new/src/transport/TPTPAgentCompTL/ACTLServer.c (-9 / +9 lines)
Lines 80-86 Link Here
80
80
81
					if(!process) 
81
					if(!process) 
82
					{
82
					{
83
						TPTP_LOG_WARNING_MSG1( stateData, "Could not find process %d.  The model may be missing information", command->info.agent_active.processId);
83
						TPTP_LOG_WARNING_MSG1( stateData, "Could not find process %d.  The model may be missing information", (int) command->info.agent_active.processId);
84
						return FALSE;
84
						return FALSE;
85
					}
85
					}
86
86
Lines 114-120 Link Here
114
	while ( current != NULL ) 
114
	while ( current != NULL ) 
115
	{
115
	{
116
		ra_command_t *command=current->command;
116
		ra_command_t *command=current->command;
117
		TPTP_LOG_DEBUG_MSG1( stateData, "Processing command: tag=%d", command->tag);
117
		TPTP_LOG_DEBUG_MSG1( stateData, "Processing command: tag=%d", (int) command->tag);
118
		switch(command->tag) 
118
		switch(command->tag) 
119
		{
119
		{
120
			case RA_CUSTOM_COMMAND:
120
			case RA_CUSTOM_COMMAND:
Lines 130-136 Link Here
130
				processExternalErrorMessage(stateData, command, agent);
130
				processExternalErrorMessage(stateData, command, agent);
131
				break;
131
				break;
132
			default:
132
			default:
133
				TPTP_LOG_WARNING_MSG1( stateData, "Received unexpected commmand from agent: tag=%d", command->tag);
133
				TPTP_LOG_WARNING_MSG1( stateData, "Received unexpected commmand from agent: tag=%d", (int) command->tag);
134
				break;
134
				break;
135
		}
135
		}
136
		current=current->next;
136
		current=current->next;
Lines 151-157 Link Here
151
		ra_addCommandToMessage(forwardMessage, command);
151
		ra_addCommandToMessage(forwardMessage, command);
152
152
153
		/* 187443 end */
153
		/* 187443 end */
154
		TPTP_LOG_DEBUG_MSG1( stateData, "Forwarding command to client: tag=%d", command->tag);
154
		TPTP_LOG_DEBUG_MSG1( stateData, "Forwarding command to client: tag=%d", (int) command->tag);
155
155
156
		/* Convert this command into a format the client will recognize */
156
		/* Convert this command into a format the client will recognize */
157
		if ( 0 != convertCommandToXML( stateData, agent->agentID, agent->client->clientID, command, &buffer ) )
157
		if ( 0 != convertCommandToXML( stateData, agent->agentID, agent->client->clientID, command, &buffer ) )
Lines 174-180 Link Here
174
	}
174
	}
175
	else
175
	else
176
	{
176
	{
177
		TPTP_LOG_WARNING_MSG1( stateData, "Agent with no attached client attempted to send custom command: tag=%d", command->tag);
177
		TPTP_LOG_WARNING_MSG1( stateData, "Agent with no attached client attempted to send custom command: tag=%d", (int) command->tag);
178
	}
178
	}
179
}
179
}
180
180
Lines 197-203 Link Here
197
#else
197
#else
198
	TPTP_LOG_MSG4( stateData, command->info.error_string.severity, "EXTERNAL: %s:%d  MESSAGE_ID=%s  MESSAGE= %s"
198
	TPTP_LOG_MSG4( stateData, command->info.error_string.severity, "EXTERNAL: %s:%d  MESSAGE_ID=%s  MESSAGE= %s"
199
					, command->info.error_string.agent.data
199
					, command->info.error_string.agent.data
200
					, command->info.error_string.processId
200
					, (int) command->info.error_string.processId
201
					, command->info.error_string.messageId.data
201
					, command->info.error_string.messageId.data
202
					, command->info.error_string.message.data);
202
					, command->info.error_string.message.data);
203
#endif
203
#endif
Lines 278-284 Link Here
278
278
279
		message = ra_readMessageFromBuffer( pBuffer, (unsigned long)bytesRead );
279
		message = ra_readMessageFromBuffer( pBuffer, (unsigned long)bytesRead );
280
280
281
		TPTP_LOG_DEBUG_MSG1( stateData, "Processing message of length %d bytes.", message->length );
281
		TPTP_LOG_DEBUG_MSG1( stateData, "Processing message of length %d bytes.", (int) message->length );
282
282
283
		/* Most messages use an agent pointer, so we'll protect the list while we're processing */
283
		/* Most messages use an agent pointer, so we'll protect the list while we're processing */
284
		ra_mutexEnter( &actlData->processList->lock );
284
		ra_mutexEnter( &actlData->processList->lock );
Lines 345-351 Link Here
345
	buffer = (unsigned char*)tptp_malloc( TPTP_DEFAULT_BUFFER_LENGTH+1 );
345
	buffer = (unsigned char*)tptp_malloc( TPTP_DEFAULT_BUFFER_LENGTH+1 );
346
	if ( buffer == NULL )
346
	if ( buffer == NULL )
347
	{
347
	{
348
		return TPTP_SYS_NO_MEM;
348
		return 0;
349
	}
349
	}
350
350
351
	/* initial status before the thread is running */
351
	/* initial status before the thread is running */
Lines 425-431 Link Here
425
425
426
	cleanPipeUp(pPipe);
426
	cleanPipeUp(pPipe);
427
427
428
	return ( rc );
428
	return 0;
429
}
429
}
430
430
431
431
(-)src-native-new/src/transport/TPTPAgentCompTL/RACAgentSupport.c (-1 / +17 lines)
Lines 14-19 Link Here
14
 *
14
 *
15
 *******************************************************************************/ 
15
 *******************************************************************************/ 
16
16
17
#include <string.h>
18
19
#include "tptp/TPTPConfig.h"
17
#include "tptp/TPTPTypes.h"
20
#include "tptp/TPTPTypes.h"
18
#include "tptp/TPTPSupportTypes.h"
21
#include "tptp/TPTPSupportTypes.h"
19
#include "tptp/TPTPSupportUtils.h"
22
#include "tptp/TPTPSupportUtils.h"
Lines 426-445 Link Here
426
429
427
static void deleteAgentList(agent_list_t *list) {
430
static void deleteAgentList(agent_list_t *list) {
428
	agent_list_node_t *current;
431
	agent_list_node_t *current;
432
	char pipeFullName[_MAX_PATH], *pipeName;
429
433
430
	if(!list) {
434
	if(!list) {
431
		return;
435
		return;
432
	}
436
	}
433
	current=list->head;
437
	current=list->head;
434
438
439
	strcpy(pipeFullName, RA_PIPE_NAMESPACE);
440
	pipeName = pipeFullName + strlen(RA_PIPE_NAMESPACE);
441
435
	while(current != NULL) {
442
	while(current != NULL) {
436
		agent_list_node_t *temp=current;
443
		agent_list_node_t *temp=current;
444
445
		disconnectFromNamedPipe(current->agent->pipe);
446
447
		if (current->agent->agentUUID.data != NULL) {
448
			strcpy(pipeName, current->agent->agentUUID.data);
449
			destroyNamedPipe(pipeFullName);
450
		}
451
437
		ra_destroyRASTRING(&current->agent->agentName);
452
		ra_destroyRASTRING(&current->agent->agentName);
438
		ra_destroyRASTRING(&current->agent->agentUUID);
453
		ra_destroyRASTRING(&current->agent->agentUUID);
439
		ra_destroyRASTRING(&current->agent->agentType);
454
		ra_destroyRASTRING(&current->agent->agentType);
440
		
455
				
441
		tptp_free(current->agent);
456
		tptp_free(current->agent);
442
		current->agent=NULL;
457
		current->agent=NULL;
458
443
		current=current->next;
459
		current=current->next;
444
		tptp_free(temp);
460
		tptp_free(temp);
445
	}
461
	}
(-)src-native-new/src/transport/transportSupport/TransportSupportNamedPipe_win.c (-6 lines)
Lines 298-309 Link Here
298
		return (HANDLE) -1;
298
		return (HANDLE) -1;
299
	}
299
	}
300
300
301
	if(!pPipeName || !pNameSpace) 
302
	{
303
		TPTP_LOG_ERROR_MSG("Create pipe - Null name");
304
		return (HANDLE) -1;
305
	}
306
307
	/* Build the full pipe name */
301
	/* Build the full pipe name */
308
	sprintf(pFullName, "%s%s", pNameSpace, pPipeName) ;
302
	sprintf(pFullName, "%s%s", pNameSpace, pPipeName) ;
309
303
(-)src-native-new/src/transport/namedPipeTL/NamedPipeListener.c (-2 / +23 lines)
Lines 391-398 Link Here
391
	return ( 0 ) ;
391
	return ( 0 ) ;
392
}
392
}
393
393
394
395
396
/**
394
/**
397
 *********************************************************
395
 *********************************************************
398
 *
396
 *
Lines 1111-1116 Link Here
1111
	return ( isConnectedSuccessful == 0 ) ;
1109
	return ( isConnectedSuccessful == 0 ) ;
1112
}
1110
}
1113
1111
1112
int closeConnections(server_block_t* pServerData) {
1113
	int i, tabSize;
1114
	tptp_uint32* list;
1115
	request_block_ptr_t pBlk;
1116
1117
	tabSize = tableSize(pServerData->connectionTable);
1118
	if (tabSize <= 0) return 0;
1119
	
1120
	list = (tptp_uint32*) malloc(tabSize*sizeof(tptp_uint32));
1121
	tableKeysAsList(pServerData->connectionTable, list, tabSize);
1122
		
1123
	for (i=0; i<tabSize; i++) {
1124
		pBlk = (request_block_ptr_t) tableGet (pServerData->connectionTable, list[i]);
1125
		if (pBlk != NULL) destroyNamedPipe(pBlk->fullPipeName);
1126
	}		
1127
1128
	free (list);
1129
1130
	return 0;	
1131
}
1114
1132
1115
1133
1116
/**
1134
/**
Lines 1130-1135 Link Here
1130
1148
1131
	/* stop the running thread */
1149
	/* stop the running thread */
1132
	pServerData->threadStatus = IDLE ;
1150
	pServerData->threadStatus = IDLE ;
1151
	
1152
	destroyNamedPipe(pServerData->fullPipeName);
1153
	closeConnections(pServerData);
1133
1154
1134
	return ( 0 ) ;
1155
	return ( 0 ) ;
1135
}
1156
}

Return to bug 181534