当前位置: 首页>>代码示例>>C++>>正文


C++ Crypto::release方法代码示例

本文整理汇总了C++中Crypto::release方法的典型用法代码示例。如果您正苦于以下问题:C++ Crypto::release方法的具体用法?C++ Crypto::release怎么用?C++ Crypto::release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Crypto的用法示例。


在下文中一共展示了Crypto::release方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: fileHandler


//.........这里部分代码省略.........
      {
         char* buf = NULL;
         int size = 136;
         if (self->m_DataChn.recv(client_ip, client_port, transid, buf, size) < 0)
            break;

         int32_t response = bWrite ? 0 : -1;
         if (fhandle.fail() || !success || !self->m_bDiskHealth || !self->m_bNetworkHealth)
            response = -1;
         if (self->m_DataChn.send(client_ip, client_port, transid, (char*)&response, 4) < 0)
            break;
         if (response == -1)
            break;

         src_ip = buf;
         src_port = *(int32_t*)(buf + 64);
         dst_ip = buf + 68;
         dst_port = *(int32_t*)(buf + 132);
         delete [] buf;

         if (src_port > 0)
         {
            // connect to uplink in the write chain
            if (!self->m_DataChn.isConnected(src_ip, src_port))
               self->m_DataChn.connect(src_ip, src_port);
         }
         else
         {
            // first node in the chain, read from client
            src_ip = client_ip;
            src_port = client_port;
         }
         
         if (dst_port > 0)
         {
            //connect downlink in the write chain
            if (!self->m_DataChn.isConnected(dst_ip, dst_port))
               self->m_DataChn.connect(dst_ip, dst_port);
         }

         break;
      }

      default:
         break;
      }
   }

   // close local file
   fhandle.close();

   // update final timestamp
   if (last_timestamp > 0)
   {
      utimbuf ut;
      ut.actime = last_timestamp;
      ut.modtime = last_timestamp;
      utime(filename.c_str(), &ut);
   }

   gettimeofday(&t2, 0);
   int duration = t2.tv_sec - t1.tv_sec;
   double avgRS = 0;
   double avgWS = 0;
   if (duration > 0)
   {
      avgRS = rb / duration * 8.0 / 1000000.0;
      avgWS = wb / duration * 8.0 / 1000000.0;
   }

   self->m_SectorLog << LogStart(LogLevel::LEVEL_3) << "file server closed " << src_ip << " " << src_port << " " << (long long)avgWS << " " << (long long)avgRS << LogEnd();

   // clear this transaction
   self->m_TransManager.updateSlave(transid, self->m_iSlaveID);

   // unlock the file
   // this must be done before the client is disconnected, otherwise if the client immediately re-open the file, the lock may not be released yet
   self->m_pLocalFile->unlock(sname, key, mode);

   // report to master the task is completed
   // this also must be done before the client is disconnected, otherwise client may not be able to immediately re-open the file as the master is not updated
   int change = m_bChange ? +FileChangeType::FILE_UPDATE_WRITE : +FileChangeType::FILE_UPDATE_NO;

   self->report(master_ip, master_port, transid, sname, change);

   if (bSecure)
   {
      encoder->release();
      delete encoder;
      decoder->release();
      delete decoder;
   }

   if (success)
      self->m_DataChn.send(client_ip, client_port, transid, (char*)&cmd, 4);
   else
      self->m_DataChn.sendError(client_ip, client_port, transid);

   return NULL;
}
开发者ID:norouzi4d,项目名称:sector,代码行数:101,代码来源:serv_file.cpp


注:本文中的Crypto::release方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。