summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBjörn Hagemeister2014-09-23 17:32:32 +0200
committerBjörn Hagemeister2014-09-23 17:32:32 +0200
commitb777398c3b4a081edffdb66bfe01a03a0044bf76 (patch)
tree7f223c1840f3cda86e9f5172c60699b18096130f /src
parentRemoved out-commented code. (diff)
downloadsatellite-daemon-b777398c3b4a081edffdb66bfe01a03a0044bf76.tar.gz
satellite-daemon-b777398c3b4a081edffdb66bfe01a03a0044bf76.tar.xz
satellite-daemon-b777398c3b4a081edffdb66bfe01a03a0044bf76.zip
Removed unnesseccary code in getUploadInfos(...)
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/openslx/satellitedaemon/filetransfer/ThriftConnection.java43
1 files changed, 14 insertions, 29 deletions
diff --git a/src/main/java/org/openslx/satellitedaemon/filetransfer/ThriftConnection.java b/src/main/java/org/openslx/satellitedaemon/filetransfer/ThriftConnection.java
index f97dc6e..ab60d2f 100644
--- a/src/main/java/org/openslx/satellitedaemon/filetransfer/ThriftConnection.java
+++ b/src/main/java/org/openslx/satellitedaemon/filetransfer/ThriftConnection.java
@@ -33,6 +33,7 @@ import org.openslx.imagemaster.thrift.iface.UploadException;
import org.openslx.imagemaster.thrift.iface.UploadInfos;
import org.openslx.satellitedaemon.Globals;
import org.openslx.satellitedaemon.db.DbImage;
+import org.openslx.satellitedaemon.db.DbImage.Status;
import org.openslx.satellitedaemon.util.EncryptWithServerIdPublicKey;
// TODO: Handle all the auto-generated catch blocks in a meaningful way
@@ -48,8 +49,6 @@ public class ThriftConnection {
private static Logger log = Logger.getLogger(ThriftConnection.class);
private static CrcFile crc = null;
- // counter for counting how often getUploadInfos was called.
- private static int counter = 0;
/***********************************************************************************************/
/**
@@ -70,32 +69,15 @@ public class ThriftConnection {
return null;
}
- if (counter == 0) {
- // method called for the first time.
- // .submitImage needs the List<Integer> from CRCFile.getCRCs() only
- // on the first time called. null afterwards.
- log.info("First call of submitImage following...");
- crc = new CrcFile(filename);
- log.info("Made CRCFile from " + filename);
- log.info("crc.getCrcSums( ).size = " + crc.getCrcSums().size());
- // log.info( "crc.getMasterSum() : " + crc.getMasterSum() );
- // for ( int i = 0; i < crc.getCrcSums().size() - 1; i++ ) {
- // log.info( "crc.getCRCSum() : " + crc.getCRCSum( i ) );
- // }
-
- // increment counter.
- counter++;
- return theClient
- .submitImage(sSD.sessionId, imDat, crc.getCrcSums());
- } else {
- // method not called for the first time.
- // .submitImage needs the List<Integer> from CRCFile.getCRCs() only
- // on the first time called. null afterwards. --Was the plan. So far
- // not working I guess.
- counter++;
- return theClient
- .submitImage(sSD.sessionId, imDat, null);
- }
+ crc = new CrcFile(filename);
+ log.info("Made CRCFile from " + filename);
+ log.info("crc.getCrcSums( ).size = " + crc.getCrcSums().size());
+ // log.info( "crc.getMasterSum() : " + crc.getMasterSum() );
+ // for ( int i = 0; i < crc.getCrcSums().size() - 1; i++ ) {
+ // log.info( "crc.getCRCSum() : " + crc.getCRCSum( i ) );
+ // }
+ return theClient
+ .submitImage(sSD.sessionId, imDat, crc.getCrcSums());
} catch (ImageDataException e) {
if (e.isSetNumber()
&& e.getNumber().equals(ImageDataError.INVALID_DATA)) {
@@ -181,7 +163,6 @@ public class ThriftConnection {
log.error("Client was null!");
return null;
}
-
return theClient.getImage(imDat.guid, sSD.sessionId);
} catch (ImageDataException e) {
if (e.isSetNumber()
@@ -192,6 +173,10 @@ public class ThriftConnection {
// The image requested is not known.
// TODO: change field image_syncMode, so the image is not asked
// for again.
+ // Now just changed status of image. Currently no possibility
+ // for creating new useful state in DB. (Offenburg)
+ log.info("Image not known. For skipping next time, mark as only_local.");
+ imDat.updateStatus(Status.only_local);
// Plus add a note in some way to mark as unknown by Server
} else {
e.printStackTrace();