~ubuntu-branches/debian/sid/nordugrid-arc/sid

« back to all changes in this revision

Viewing changes to src/hed/dmc/xrootd/DataPointXrootd.cpp

  • Committer: Package Import Robot
  • Author(s): Mattias Ellert
  • Date: 2012-12-13 16:41:31 UTC
  • mfrom: (1.1.5)
  • Revision ID: package-import@ubuntu.com-20121213164131-0fumka0jar8mxm07
Tags: 2.0.1-1
* 2.0.1 Release
* Drop patches accepted upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
147
147
    // wait for open to complete
148
148
    if (!client->IsOpen_wait()) {
149
149
      logger.msg(ERROR, "Failed to open file %s", url.str());
 
150
      reading = false;
150
151
      return DataStatus::ReadStartError;
151
152
    }
152
153
 
155
156
      FileInfo file;
156
157
      DataPointInfoType info(INFO_TYPE_CONTENT);
157
158
      if (!Stat(file, info))
 
159
        reading = false;
158
160
        return DataStatus::ReadStartError;
159
161
    }
160
162
 
164
166
    if(!CreateThreadFunction(&DataPointXrootd::read_file_start, this)) {
165
167
      client->Close();
166
168
      reading = false;
 
169
      buffer = NULL;
167
170
      return DataStatus::ReadStartError;
168
171
    }
169
172
 
173
176
  DataStatus DataPointXrootd::StopReading() {
174
177
    if (!reading) return DataStatus::ReadStopError;
175
178
    reading = false;
 
179
    if (!buffer) return DataStatus::ReadStopError;
176
180
    if (!buffer->eof_read()) {
177
181
      buffer->error_read(true);      /* trigger transfer error */
178
182
      client->Close();
179
183
    }
180
184
    transfer_cond.wait();         /* wait till reading thread exited */
181
 
    if (buffer->error_read())
 
185
    if (buffer->error_read()) {
 
186
      buffer = NULL;
182
187
      return DataStatus::ReadError;
 
188
    }
 
189
    buffer = NULL;
183
190
    return DataStatus::Success;
184
191
  }
185
192