summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/org/openslx/satellitedaemon/filetransfer/ThriftConnection.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/main/java/org/openslx/satellitedaemon/filetransfer/ThriftConnection.java b/src/main/java/org/openslx/satellitedaemon/filetransfer/ThriftConnection.java
index 0502768..c52b45b 100644
--- a/src/main/java/org/openslx/satellitedaemon/filetransfer/ThriftConnection.java
+++ b/src/main/java/org/openslx/satellitedaemon/filetransfer/ThriftConnection.java
@@ -289,8 +289,17 @@ public class ThriftConnection
*/
public static boolean registerSatellite( String organizationId, String ipAddress, String modulus, String exponent )
{
- ImageServer.Client theClient = null;
- theClient = getConnection();
+ ImageServer.Client theClient = client.get();
+
+ if ( theClient == null ) {
+ // There is no client instance for this thread, create a new one
+ log.info( "No existing client for this thread. Making a new client ..." );
+ theClient = newClient();
+ if ( theClient == null ) {
+ log.debug( "The client was null after newClient()" );
+ return false;
+ }
+ }
// No check for valid connection. --> not needed, because this satellite is not known yet by master.
try {
return theClient.registerSatellite( organizationId, ipAddress, modulus, exponent );