Diff
Not logged in

Differences From Artifact [5913e8b5ac]:

To Artifact [43851bc51d]:


     1      1   // Copyright 2015 MaidSafe.net limited.
     2      2   //
     3      3   // This SAFE Network Software is licensed to you under (1) the MaidSafe.net Commercial License,
     4      4   // version 1.0 or later, or (2) The General Public License (GPL), version 3, depending on which
     5      5   // licence you accepted on initial access to the Software (the "Licences").
     6      6   //
     7      7   // By contributing code to the SAFE Network Software, or to this project generally, you agree to be
     8         -// bound by the terms of the MaidSafe Contributor Agreement, version 1.1.  This, along with the
     9         -// Licenses can be found in the root directory of this project at LICENSE, COPYING and CONTRIBUTOR.
            8  +// bound by the terms of the MaidSafe Contributor Agreement.  This, along with the Licenses can be
            9  +// found in the root directory of this project at LICENSE, COPYING and CONTRIBUTOR.
    10     10   //
    11     11   // Unless required by applicable law or agreed to in writing, the SAFE Network Software distributed
    12     12   // under the GPL Licence is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    13     13   // KIND, either express or implied.
    14     14   //
    15     15   // Please review the Licences for the specific language governing permissions and limitations
    16     16   // relating to use of the SAFE Network Software.
................................................................................
    76     76   
    77     77       /// Send a `Get` request to the network and return the data received in the response.
    78     78       ///
    79     79       /// This is a blocking call and will wait indefinitely for the response.
    80     80       pub fn get(&mut self, request: DataIdentifier) -> Option<Data> {
    81     81           let message_id = MessageId::new();
    82     82           unwrap!(self.routing_client
    83         -            .send_get_request(Authority::NaeManager(*request.name()),
    84         -                              request.clone(),
    85         -                              message_id));
           83  +                    .send_get_request(Authority::NaeManager(*request.name()),
           84  +                                      request.clone(),
           85  +                                      message_id));
    86     86   
    87     87           // Wait for Get success event from Routing
    88     88           loop {
    89     89               match recv_with_timeout(&self.receiver, Duration::from_secs(RESPONSE_TIMEOUT_SECS)) {
    90     90                   Some(Event::Response { response: Response::GetSuccess(data, id), .. }) => {
    91     91                       if message_id != id {
    92     92                           error!("GetSuccess for {:?}, but with wrong message_id {:?} instead of \
................................................................................
    94     94                                  data.name(),
    95     95                                  id,
    96     96                                  message_id);
    97     97                       }
    98     98                       return Some(data);
    99     99                   }
   100    100                   Some(Event::Response {
   101         -                    response: Response::GetFailure { external_error_indicator, .. },
   102         -                .. }) => {
          101  +                         response: Response::GetFailure { external_error_indicator, .. }, ..
          102  +                     }) => {
   103    103                       error!("Failed to Get {:?}: {:?}",
   104    104                              request.name(),
   105    105                              unwrap!(String::from_utf8(external_error_indicator)));
   106    106                       return None;
   107    107                   }
   108    108                   Some(Event::Terminate) |
   109    109                   Some(Event::RestartRequired) => self.disconnected(),
................................................................................
   117    117       ///
   118    118       /// This is a blocking call and will wait indefinitely for a `PutSuccess` or `PutFailure`
   119    119       /// response.
   120    120       pub fn put(&self, data: Data) -> Result<(), ()> {
   121    121           let data_id = data.identifier();
   122    122           let message_id = MessageId::new();
   123    123           unwrap!(self.routing_client
   124         -            .send_put_request(Authority::ClientManager(*self.name()), data, message_id));
          124  +                    .send_put_request(Authority::ClientManager(*self.name()),
          125  +                                      data,
          126  +                                      message_id));
   125    127   
   126    128           // Wait for Put success event from Routing
   127    129           loop {
   128    130               match recv_with_timeout(&self.receiver, Duration::from_secs(RESPONSE_TIMEOUT_SECS)) {
   129         -                Some(Event::Response { response: Response::PutSuccess(rec_data_id, id), .. }) => {
          131  +                Some(Event::Response {
          132  +                         response: Response::PutSuccess(rec_data_id, id), ..
          133  +                     }) => {
   130    134                       if message_id != id {
   131    135                           error!("Stored {:?}, but with wrong message_id {:?} instead of {:?}.",
   132    136                                  data_id.name(),
   133    137                                  id,
   134    138                                  message_id);
   135    139                           return Err(());
   136    140                       } else if data_id == rec_data_id {