You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by pn...@apache.org on 2012/12/11 18:58:37 UTC

svn commit: r1420306 - in /incubator/celix/trunk: CMakeLists.txt remote_shell/private/src/connection_listener.c remote_shell/private/src/remote_shell.c remote_shell/private/src/shell_mediator.c

Author: pnoltes
Date: Tue Dec 11 17:58:35 2012
New Revision: 1420306

URL: http://svn.apache.org/viewvc?rev=1420306&view=rev
Log:
CELIX-44: 
 - added parent pool for socket memory pool creating. Creating with NULL as parent will give segfault in some cases
 - fixed bug for uninitialized var
 - Added a print errors for closing connections
 - Corrected CMakeLists dependency order

Modified:
    incubator/celix/trunk/CMakeLists.txt
    incubator/celix/trunk/remote_shell/private/src/connection_listener.c
    incubator/celix/trunk/remote_shell/private/src/remote_shell.c
    incubator/celix/trunk/remote_shell/private/src/shell_mediator.c

Modified: incubator/celix/trunk/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/CMakeLists.txt?rev=1420306&r1=1420305&r2=1420306&view=diff
==============================================================================
--- incubator/celix/trunk/CMakeLists.txt (original)
+++ incubator/celix/trunk/CMakeLists.txt Tue Dec 11 17:58:35 2012
@@ -42,9 +42,9 @@ add_subdirectory(examples)
 add_subdirectory(device_access)
 add_subdirectory(deployment_admin)
 add_subdirectory(remote_services)
+add_subdirectory(remote_shell)
 add_subdirectory(shell_tui)
 add_subdirectory(shell)
-add_subdirectory(remote_shell)
 add_subdirectory(log_writer)
 add_subdirectory(log_service)
 

Modified: incubator/celix/trunk/remote_shell/private/src/connection_listener.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/remote_shell/private/src/connection_listener.c?rev=1420306&r1=1420305&r2=1420306&view=diff
==============================================================================
--- incubator/celix/trunk/remote_shell/private/src/connection_listener.c (original)
+++ incubator/celix/trunk/remote_shell/private/src/connection_listener.c Tue Dec 11 17:58:35 2012
@@ -157,7 +157,7 @@ static void* APR_THREAD_FUNC connection_
 		if (status == APR_SUCCESS) {
 			acceptedSocket = NULL;
 			apr_pool_t *socketPool = NULL;
-			apr_pool_create(&socketPool, NULL);
+			apr_pool_create(&socketPool, instance->pool);
 			apr_status_t socketStatus = apr_socket_accept(&acceptedSocket, listenSocket, socketPool);
 			printf("REMOTE_SHELL: created connection socket\n");
 			if (socketStatus == APR_SUCCESS) {

Modified: incubator/celix/trunk/remote_shell/private/src/remote_shell.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/remote_shell/private/src/remote_shell.c?rev=1420306&r1=1420305&r2=1420306&view=diff
==============================================================================
--- incubator/celix/trunk/remote_shell/private/src/remote_shell.c (original)
+++ incubator/celix/trunk/remote_shell/private/src/remote_shell.c Tue Dec 11 17:58:35 2012
@@ -137,17 +137,22 @@ celix_status_t remoteShell_addConnection
 
 celix_status_t remoteShell_stopConnections(remote_shell_t instance) {
 	celix_status_t status = CELIX_SUCCESS;
+	apr_status_t wakeupStatus = APR_SUCCESS;
+	char error[64];
 
 	apr_thread_mutex_lock(instance->mutex);
 	int length = arrayList_size(instance->connections);
 	for (int i = 0; i < length; i += 1) {
 		connection_t connection = arrayList_get(instance->connections, i);
-		apr_pollset_wakeup(connection->pollset);
+		wakeupStatus = apr_pollset_wakeup(connection->pollset);
+		if (wakeupStatus != APR_SUCCESS) {
+			apr_strerror(wakeupStatus, error, 64);
+			printf("Error waking up connection %i: '%s'\n", i, error);
+		}
 	}
 	apr_thread_mutex_unlock(instance->mutex);
 	apr_thread_pool_tasks_cancel(instance->threadPool,instance);
 
-
 	return status;
 }
 

Modified: incubator/celix/trunk/remote_shell/private/src/shell_mediator.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/remote_shell/private/src/shell_mediator.c?rev=1420306&r1=1420305&r2=1420306&view=diff
==============================================================================
--- incubator/celix/trunk/remote_shell/private/src/shell_mediator.c (original)
+++ incubator/celix/trunk/remote_shell/private/src/shell_mediator.c Tue Dec 11 17:58:35 2012
@@ -105,7 +105,7 @@ static void shellMediator_writeOnCurrent
 }
 
 celix_status_t shellMediator_executeCommand(shell_mediator_t instance, char *command, apr_socket_t *socket) {
-	apr_status_t status;
+	apr_status_t status = CELIX_SUCCESS;
 
 	apr_thread_mutex_lock(instance->mutex);
 	if (instance->shellService != NULL) {