~ubuntu-branches/ubuntu/precise/nordugrid-arc/precise

« back to all changes in this revision

Viewing changes to src/libs/data-staging/DTR.cpp

  • Committer: Package Import Robot
  • Author(s): Mattias Ellert
  • Date: 2012-03-01 19:48:16 UTC
  • mfrom: (3.1.5 sid)
  • Revision ID: package-import@ubuntu.com-20120301194816-m1ezrwnwt2qgnc2e
Tags: 1.1.1-1
* 1.1.1 Bugfix Release
* Fixes FTBFS (Closes: #661774) (LP: #935007)
* Fix typo in package description (Closes: #646979)
* Split binary rule in debian/rules for arch and indep

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
#include <config.h>
3
3
#endif
4
4
 
 
5
#include <utime.h>
 
6
 
 
7
#include <arc/FileLock.h>
5
8
#include <arc/GUID.h>
 
9
#include <arc/Utils.h>
6
10
 
7
11
#include "Processor.h"
8
12
#include "DataDelivery.h"
40
44
       cfg(usercfg),
41
45
       source_endpoint(source_url, cfg),
42
46
       destination_endpoint(destination_url, cfg),
 
47
       source_url_str(source_url.str()),
 
48
       destination_url_str(destination_url.str()),
43
49
       user(uid),
44
50
       parent_job_id(jobid),
45
51
       priority(50),
46
52
       transfershare("_default"),
47
53
       sub_share(""),
48
54
       tries_left(1),
 
55
       initial_tries(1),
49
56
       replication(false),
50
57
       force_registration(false),
51
58
       status(DTRStatus::NEW,"Created by the generator"),
110
117
      cfg(dtr.cfg),
111
118
      source_endpoint(source_url, cfg),
112
119
      destination_endpoint(destination_url, cfg),
 
120
      source_url_str(source_url.str()),
 
121
      destination_url_str(destination_url.str()),
113
122
      cache_file(dtr.cache_file),
114
123
      cache_parameters(dtr.cache_parameters),
115
124
      cache_state(dtr.cache_state),
119
128
      transfershare(dtr.transfershare),
120
129
      sub_share(dtr.sub_share),
121
130
      tries_left(dtr.tries_left),
 
131
      initial_tries(dtr.initial_tries),
122
132
      replication(dtr.replication),
123
133
      force_registration(dtr.force_registration),
124
134
      mapped_source(dtr.mapped_source),
138
148
      lock()
139
149
  {
140
150
    // set insecure by default. Real value will come from configuration
141
 
    source_endpoint->SetSecure(false);
142
 
    destination_endpoint->SetSecure(false);
 
151
    if (source_endpoint) source_endpoint->SetSecure(false);
 
152
    if (destination_endpoint) destination_endpoint->SetSecure(false);
143
153
 
144
154
    mark_modification();
145
155
  }
203
213
  }
204
214
  
205
215
  void DTR::set_tries_left(unsigned int tries) {
206
 
    tries_left = tries;
 
216
    initial_tries = tries;
 
217
    tries_left = initial_tries;
207
218
  }
208
219
 
209
220
  void DTR::decrease_tries_left() {
253
264
 
254
265
  void DTR::set_bytes_transferred(unsigned long long int bytes) {
255
266
    bytes_transferred = bytes;
256
 
    mark_modification();
257
267
  }
258
268
 
259
269
  void DTR::set_cache_file(const std::string& filename)
282
292
    next_process_time.SetTime(t.GetTime(), t.GetTimeNanosec());
283
293
  }
284
294
 
 
295
 
285
296
  std::list<DTRCallback*> DTR::get_callbacks(const std::map<StagingProcesses,std::list<DTRCallback*> >& proc_callback, StagingProcesses owner) {
286
297
    std::list<DTRCallback*> l;
287
298
    lock.lock();
353
364
  }
354
365
  
355
366
  bool DTR::is_destined_for_delivery() const {
356
 
        return (status == DTRStatus::TRANSFER_WAIT);
 
367
        return (status == DTRStatus::TRANSFER);
357
368
  }
358
369
  
359
370
  bool DTR::came_from_pre_processor() const {
384
395
           status == DTRStatus::ERROR);
385
396
  }
386
397
  
387
 
  void DTR::set_transfer_share(std::string share_name) {
 
398
  void DTR::set_transfer_share(const std::string& share_name) {
388
399
        lock.lock(); 
389
400
        transfershare = share_name;
390
401
        if (!sub_share.empty())