本文整理汇总了C++中HAGGLE_ERR函数的典型用法代码示例。如果您正苦于以下问题:C++ HAGGLE_ERR函数的具体用法?C++ HAGGLE_ERR怎么用?C++ HAGGLE_ERR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了HAGGLE_ERR函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: getKey
void
ReplicationOptimizer::notifySendFailure(DataObjectRef dObj, NodeRef node)
{
if (utilFunction) {
utilFunction->notifySendFailure(dObj, node);
}
string dobj_id = DataObject::idString(dObj);
string node_id = Node::idString(node);
string key = getKey(dobj_id, node_id);
meta_map_t::iterator it = meta.find(key);
if (it == meta.end()) {
errorCount++;
HAGGLE_ERR("Missing entry.\n");
return;
}
ReplicationDataObjectUtilityMetadataRef do_info = (*it).second;
if (!do_info) {
errorCount++;
HAGGLE_ERR("Missing metadata.\n");
return;
}
Timeval now = Timeval::now();
double delta = now.getTimeAsMilliSecondsDouble() - do_info->getComputedTime().getTimeAsMilliSecondsDouble();
if (delta > computePeriodMs && utilFunction) {
double new_utility = utilFunction->compute(do_info->getId(), do_info->getNodeId());
do_info->setUtility(new_utility, now);
}
}
开发者ID:SRI-CSL,项目名称:ENCODERS,代码行数:33,代码来源:ReplicationOptimizer.cpp
示例2: getQueue
ProtocolEvent ProtocolUDPGeneric::waitForEvent(
DataObjectRef &dObj,
Timeval *timeout,
bool writeevent)
{
QueueElement *qe = NULL;
Queue *q = getQueue();
if (!q) {
return PROT_EVENT_ERROR;
}
SocketWrapper *sock = getReadEndOfReceiveSocket();
if (NULL == sock) {
HAGGLE_ERR("%s Null receive socket\n", getName());
return PROT_EVENT_ERROR_FATAL;
}
HAGGLE_DBG("%s Waiting for queue element or timeout... %s\n",
getName(), timeout->getAsString().c_str());
QueueEvent_t qev = q->retrieve(&qe,
sock->getSOCKET(),
timeout,
writeevent);
if (QUEUE_ELEMENT == qev) {
dObj = qe->getDataObject();
delete qe;
return PROT_EVENT_TXQ_NEW_DATAOBJECT;
}
if (QUEUE_EMPTY == qev) {
return PROT_EVENT_TXQ_EMPTY;
}
if (QUEUE_WATCH_WRITE == qev) {
return PROT_EVENT_WRITEABLE;
}
if (QUEUE_WATCH_ABANDONED == qev) {
// SW: this occurs when the protocol has been shutdown via some other
// mechanism, such as interface down
HAGGLE_DBG("%s Waiting for event abandoned\n", getName());
return PROT_EVENT_SHOULD_EXIT;
}
if (QUEUE_TIMEOUT == qev) {
HAGGLE_DBG("%s Waiting for event timeout\n", getName());
return PROT_EVENT_TIMEOUT;
}
if (QUEUE_WATCH_READ == qev) {
return PROT_EVENT_INCOMING_DATA;
}
HAGGLE_ERR("%s Waiting for event unknown error\n", getName());
return PROT_EVENT_ERROR;
}
开发者ID:SRI-CSL,项目名称:ENCODERS,代码行数:60,代码来源:ProtocolUDPGeneric.cpp
示例3: HAGGLE_ERR
ssize_t
SocketWrapper::sendTo(
const void *buf,
size_t len,
int flags,
const struct sockaddr *to,
socklen_t tolen)
{
if ((NULL == to) || (NULL == buf)) {
HAGGLE_ERR("Invalid argument\n");
return -1;
}
if (INVALID_SOCKET == sock) {
HAGGLE_ERR("Cannot sendto on closed socket\n");
return -1;
}
ssize_t ret = sendto(sock, (const char *)buf, len, flags, to, tolen);
if (-1 == ret) {
HAGGLE_ERR("Sendto failed : %s\n", STRERROR(ERRNO));
}
return ret;
}
开发者ID:SRI-CSL,项目名称:ENCODERS,代码行数:26,代码来源:SocketWrapper.cpp
示例4: HAGGLE_DBG
bool ResourceMonitorAndroid::run()
{
Watch w;
HAGGLE_DBG("Running resource monitor\n");
if (uevent_init() == -1) {
HAGGLE_ERR("Could not open uevent socket\n");
return false;
}
while (!shouldExit()) {
int ret;
w.reset();
int ueventIndex = w.add(uevent_fd);
ret = w.wait();
if (ret == Watch::ABANDONED) {
break;
} else if (ret == Watch::FAILED) {
HAGGLE_ERR("Wait on objects failed\n");
break;
}
if (w.isSet(ueventIndex)) {
uevent_read();
}
}
return false;
}
开发者ID:SRI-CSL,项目名称:ENCODERS,代码行数:33,代码来源:ResourceMonitorAndroid.cpp
示例5: getKey
bool
ReplicationManagerObjectState::getMatchStrength(string dobj_id, string node_name, int *o_ratio, int *o_threshold)
{
string key = getKey(dobj_id, node_name);
if (!o_ratio) {
HAGGLE_ERR("NULL ratio ptr.\n");
errorCount++;
return false;
}
if (!o_threshold) {
HAGGLE_ERR("NULL threshold ptr.\n");
errorCount++;
return false;
}
// NOTE: data objects with 0 overlap in attributes will not
// show up in the dataObjectIdMatch data structure
int ratio = 0;
int threshold = 0;
Map<string, match>::iterator it = dataObjectIdMatch.find(key);
if (it != dataObjectIdMatch.end()) {
match m = (*it).second;
ratio = m.ratio;
threshold = m.threshold;
}
*o_ratio = ratio;
*o_threshold = threshold;
return true;
}
开发者ID:SRI-CSL,项目名称:ENCODERS,代码行数:34,代码来源:ReplicationManagerObjectState.cpp
示例6: sendBuffer
static bool sendBuffer(SOCKET sock, const void *data, size_t toSend)
{
size_t i = 0;
do {
ssize_t ret = send(sock, (char *)data + i, toSend, 0);
if (ret == -1) {
#if defined(OS_WINDOWS)
if (WSAGetLastError() != WSAEWOULDBLOCK) {
HAGGLE_ERR("Could not write HTTP to socket err=%d\n", ERRNO);
goto out;
}
#else
if (errno != EAGAIN) {
HAGGLE_ERR("Could not write HTTP to socket err=%d\n", errno);
goto out;
}
#endif
} else {
toSend -= ret;
i += ret;
}
} while (toSend > 0);
out:
return toSend == 0;
}
开发者ID:eikoyoneki,项目名称:haggle-label,代码行数:27,代码来源:DebugManager.cpp
示例7: HAGGLE_ERR
void
ReplicationManagerObjectState::unCacheNode(string node_name)
{
{
Map<string, NodeRef>::iterator it = cachedNodes.find(node_name);
if (it == cachedNodes.end()) {
HAGGLE_ERR("Node is not cached.\n");
errorCount++;
return;
}
NodeRef node = (*it).second;
cachedNodes.erase(it);
string node_id = Node::idString(node);
Map<string, string>::iterator itt = proxy_id_to_node_name.find(node_id);
if (itt == proxy_id_to_node_name.end()) {
HAGGLE_ERR("Proxy id is missing for node: %s\n", node_id.c_str());
errorCount++;
return;
}
proxy_id_to_node_name.erase(itt);
}
{ // synch up the indexes
bool found1 = false;
Map<string, string>::iterator it = nodeIdMatchIndex.find(node_name);
for (; it != nodeIdMatchIndex.end(); it++) {
string matchKey = (*it).second;
nodeIdMatchIndex.erase(it);
found1 = true;
// remove from match
Map<string, match>::iterator ittt = dataObjectIdMatch.find(matchKey);
if (ittt == dataObjectIdMatch.end()) {
HAGGLE_ERR("Key: %s missing from match map\n", matchKey.c_str());
break;
}
dataObjectIdMatch.erase(ittt);
// remove any left over node entries in node index if it's empty now
string dobj_id = dataObjectIdFromKey(matchKey);
bool found2 = false;
//Map<string, string>::iterator itt = dataObjectIdMatchIndex.find(dobj_id);
Map<string, string>::iterator itt = dataObjectIdMatchIndex.begin();
for (; itt != dataObjectIdMatchIndex.end(); itt++) {
if ((*itt).second == matchKey) {
found2 = true;
dataObjectIdMatchIndex.erase(itt);
break;
}
}
if (!found2) {
HAGGLE_ERR("Did not find data object: %s in object index\n", dobj_id.c_str());
errorCount++;
}
}
if (!found1) {
HAGGLE_DBG2("Did not find node: %s in node index\n", node_name.c_str());
}
}
nodesDeleted++;
}
开发者ID:SRI-CSL,项目名称:ENCODERS,代码行数:60,代码来源:ReplicationManagerObjectState.cpp
示例8: HAGGLE_ERR
// CBMEN, HL, Begin
int
ReplicationOptimizer::getCost(DataObjectRef dObj, string node_id)
{
int dataLen = 0;
{
dataLen = (int) dObj->getDataLen();
// include metadata size
Metadata *m = dObj->getMetadata();
if (!m) {
errorCount++;
HAGGLE_ERR("Missing metadata.\n");
return 0;
}
dataLen += m->getContent().size();
}
{
node_map_t::iterator it = node_map.find(node_id);
if (it == node_map.end()) {
errorCount++;
HAGGLE_ERR("Missing node: %s\n", node_id.c_str());
return 0;
}
}
return dataLen;
}
开发者ID:SRI-CSL,项目名称:ENCODERS,代码行数:28,代码来源:ReplicationOptimizer.cpp
示例9: HAGGLE_ERR
int
ReplicationKnapsackOptimizerTiebreakerCreateTime::compare(
ReplicationDataObjectUtilityMetadataRef m1,
ReplicationDataObjectUtilityMetadataRef m2)
{
if (!m1 && !m2) {
HAGGLE_ERR("NULL arguments\n");
return 0;
}
if (!m1) {
HAGGLE_ERR("NULL m1 argument.\n");
return 1;
}
if (!m2) {
HAGGLE_ERR("NULL m2 argument.\n");
return -1;
}
if (m1->getCreateTime() == m2->getCreateTime()) {
return 0;
}
if (m1->getCreateTime() < m2->getCreateTime()) {
return -1;
}
return 1;
}
开发者ID:SRI-CSL,项目名称:ENCODERS,代码行数:30,代码来源:ReplicationKnapsackOptimizer.cpp
示例10: BIO_new_mem_buf
static RSA *stringToRSAKey(const char *keyStr, KeyType_t type = KEY_TYPE_PUBLIC)
{
RSA *key = NULL;
//HAGGLE_DBG("trying to convert:\n%s\n", keyStr);
BIO *bp = BIO_new_mem_buf(const_cast<char *>(keyStr), -1);
if (!bp) {
HAGGLE_ERR("Could not allocate BIO\n");
return NULL;
}
if (type == KEY_TYPE_PUBLIC) {
if (!PEM_read_bio_RSA_PUBKEY(bp, &key, NULL, NULL)) {
HAGGLE_ERR("Could not read public key from PEM string\n");
}
} else if (type == KEY_TYPE_PRIVATE) {
if (!PEM_read_bio_RSAPrivateKey(bp, &key, NULL, NULL)) {
HAGGLE_ERR("Could not read private key from PEM string\n");
}
}
BIO_free(bp);
return key;
}
开发者ID:dmonakhov,项目名称:haggle,代码行数:27,代码来源:SecurityManager.cpp
示例11: LeakMonitor
Certificate::Certificate(const string& _subject, const string& _issuer, const string& _validity, const Node::Id_t _owner, RSA *_rsaPubKey) :
#ifdef DEBUG_LEAKS
LeakMonitor(LEAK_TYPE_CERTIFICATE),
#endif
stored(false), verified(false), hasSignature(false), x(NULL), subject(_subject), issuer(_issuer), validity(_validity), pubKey(NULL), rsaPubKey(NULL), x509_PEM_str(NULL)
{
memcpy(owner, _owner, sizeof(Node::Id_t));
x = X509_new();
if (!x) {
HAGGLE_ERR("Could not allocate X509 certificate struct\n");
return;
}
X509_set_version(x, 2);
pubKey = EVP_PKEY_new();
if (!pubKey) {
X509_free(x);
HAGGLE_ERR("Could not allocate X509 EVP_PKEY\n");
return;
}
EVP_PKEY_assign_RSA(pubKey, RSAPublicKey_dup(_rsaPubKey));
X509_set_pubkey(x, pubKey);
rsaPubKey = EVP_PKEY_get1_RSA(pubKey);
/* Set validity.
FIXME: currently hardcoded
*/
int days = 30;
X509_gmtime_adj(X509_get_notBefore(x),0);
X509_gmtime_adj(X509_get_notAfter(x),(long)60*60*24*days);
X509_NAME *subject_name = X509_get_subject_name(x);
/* Set subject */
//X509_NAME_add_entry_by_txt(subname,"C", MBSTRING_ASC, "SE", -1, -1, 0);
X509_NAME_add_entry_by_txt(subject_name, "CN", MBSTRING_ASC, (const unsigned char *)subject.c_str(), -1, -1, 0);
X509_NAME_add_entry_by_txt(subject_name, "O", MBSTRING_ASC, (const unsigned char *)"Haggle", -1, -1, 0);
X509_set_subject_name(x, subject_name);
/* Set issuer */
X509_NAME *issuer_name = X509_get_issuer_name(x);
X509_NAME_add_entry_by_txt(issuer_name, "CN", MBSTRING_ASC, (const unsigned char *)issuer.c_str(), -1, -1, 0);
X509_NAME_add_entry_by_txt(issuer_name, "O", MBSTRING_ASC, (const unsigned char *)"Haggle", -1, -1, 0);
X509_set_issuer_name(x, issuer_name);
//HAGGLE_DBG("Subject=\'%s\' issuer=\'%s\'\n", subject.c_str(), issuer.c_str());
certificate_set_serial(x);
}
开发者ID:SRI-CSL,项目名称:ENCODERS,代码行数:58,代码来源:Certificate.cpp
示例12: isNonblock
ProtocolEvent
SocketWrapper::openConnection(
const struct sockaddr *saddr,
socklen_t addrlen)
{
bool wasNonBlock = isNonblock();
if (INVALID_SOCKET == sock) {
HAGGLE_ERR("Socket is invalid\n");
return PROT_EVENT_ERROR;
}
if (!saddr) {
HAGGLE_ERR("Address is invalid\n");
return PROT_EVENT_ERROR;
}
// block while connecting
if (nonblock) {
setNonblock(false);
}
bool hasError = false;
int ret = ::connect(sock, saddr, addrlen);
if (SOCKET_ERROR == ret) {
hasError = true;
HAGGLE_ERR("Problems connecting: %s\n",
SocketWrapper::getProtocolErrorStr());
}
if (wasNonBlock) {
setNonblock(true);
}
if (!hasError) {
HAGGLE_DBG("Succesfully connected to socket.\n");
setConnected(true);
return PROT_EVENT_SUCCESS;
} else {
HAGGLE_DBG("An error occurred connecting: %s\n",
getProtocolErrorStr());
}
switch (getProtocolError()) {
case PROT_ERROR_BAD_HANDLE:
case PROT_ERROR_INVALID_ARGUMENT:
case PROT_ERROR_NO_MEMORY:
case PROT_ERROR_NOT_A_SOCKET:
case PROT_ERROR_NO_STORAGE_SPACE:
return PROT_EVENT_ERROR_FATAL;
default:
return PROT_EVENT_ERROR;
}
}
开发者ID:SRI-CSL,项目名称:ENCODERS,代码行数:58,代码来源:SocketWrapper.cpp
示例13: AllocCodedBlock
// each file buffer stores an array of coded blocks
// +-------+------------+-------+------------+-----
// | coeff | coded data | coeff | coded data | ...
// +-------+------------+-------+------------+-----
CodedBlockPtr CodeTorrent::ReadGenBuf(int gen, int k) {
// NOTE: error checking must be done prior to invoking this method!
// (i.e. are there strictly less than k blocks in this file buffer?)
// NOTE: k begins at 0
CodedBlockPtr tempBlock;
tempBlock = AllocCodedBlock(num_blocks_gen[gen], block_size);
tempBlock->gen = gen;
const char *ext = ".temp";
char *ext2 = new char[3]; // what if more than 100 gens?
#ifdef WIN32
itoa(gen, ext2, 10); // base : 10
#else
sprintf(ext2, "%d", gen);
#endif
int fname_len = strlen(filename);
int ext_len = strlen(ext);
int ext2_len = strlen(ext2);
// this is dumb but works
char *filename_read = new char[fname_len + ext_len + ext2_len + 1];
memcpy(filename_read, filename, fname_len);
memcpy(filename_read + fname_len, ext, ext_len);
memcpy(filename_read + fname_len + ext_len, ext2, ext2_len);
filename_read[fname_len + ext_len + ext2_len] = '\0';
fp = fopen(filename_read, "rb");
if(fp) HAGGLE_DBG2("Opening file %s for writing with file descriptor %d\n", filename_read, fileno(fp));
if (!fp) {
HAGGLE_ERR("CODETORRENT ERROR: cache access error!\n");
}
if (fseek(fp, (num_blocks_gen[gen] + block_size) * k, SEEK_SET)) {
HAGGLE_ERR("CODETORRENT ERROR: cache access error!\n");
}
int cf = fread(tempBlock->coeffs, 1, num_blocks_gen[gen], fp);
int sm = fread(tempBlock->sums, 1, block_size, fp);
if (cf != num_blocks_gen[gen] || sm != block_size) {
HAGGLE_ERR("CODETORRENT ERROR: cache reading error!\n");
}
fclose(fp);
delete[] filename_read;
delete[] ext2;
return tempBlock;
}
开发者ID:zeeshanabid94,项目名称:ENCODERS,代码行数:61,代码来源:codetorrent.cpp
示例14: HAGGLE_ERR
void
CachePurgerRelTTL::onConfig(
const Metadata& m)
{
if (m.getName() != getName()) {
HAGGLE_ERR("Wrong config.\n");
return;
}
const char *param;
param = m.getParameter(CACHE_PURGER_REL_TTL_METRIC);
if (!param) {
HAGGLE_ERR("No metric specified\n");
return;
}
metricField = string(param);
param = m.getParameter(CACHE_PURGER_REL_TTL_TAG);
if (!param) {
HAGGLE_ERR("No tag specified\n");
return;
}
tagField = string(param);
param = m.getParameter(CACHE_PURGER_REL_TTL_TAG_VALUE);
if (!param) {
HAGGLE_ERR("No tag value specified\n");
return;
}
tagFieldValue = string(param);
param = m.getParameter(CACHE_PURGER_REL_TTL_KEEP_IN_BF_NAME);
if (param) {
if (0 == strcmp("true", param)) {
keepInBF = true;
}
else if (0 == strcmp("false", param)) {
keepInBF = false;
}
else {
HAGGLE_ERR("Field must be true or false\n");
}
}
param = m.getParameter(CACHE_PURGER_REL_TTL_MIN_DB_TIME_S);
if (param) {
minDBtimeS = atof(param);
}
HAGGLE_DBG("Loaded relative TTL purger with metric: %s, tag=%s:%s, keep in bf: %s, min db time: %f\n",
metricField.c_str(), tagField.c_str(), tagFieldValue.c_str(), keepInBF ? "true" : "false", minDBtimeS);
}
开发者ID:SRI-CSL,项目名称:ENCODERS,代码行数:56,代码来源:CachePurgerRelTTL.cpp
示例15: HAGGLE_ERR
/*
* Helper to return the top K data objects in the cache, according to
* a specified sort function. Mainly used for statistics repoorting.
*/
void
PrintHelperHeapItem::getTopKHelper(
int K,
PrinterHelperType_t type,
do_util_metadata_t utilMetadata,
do_util_metadata_list_t *o_top10)
{
if (!o_top10) {
HAGGLE_ERR("NULL output list\n");
return;
}
Heap Kheap;
int k_count = 0;
for (do_util_metadata_t::iterator it = utilMetadata.begin();
it != utilMetadata.end(); it++) {
DataObjectUtilityMetadata *do_info = (*it).second;
if (!do_info) {
HAGGLE_ERR("NULL do metadata in map\n");
continue;
}
PrintHelperHeapItem *ele = new PrintHelperHeapItem(type, do_info);
PrintHelperHeapItem *top = static_cast<PrintHelperHeapItem *>(Kheap.front());
if (k_count++ < K) {
Kheap.insert(ele);
}
else if (!top) {
HAGGLE_ERR("Somehow popped NULL heap element\n");
}
else if (top->getMetric() < ele->getMetric()) {
Kheap.extractFirst();
Kheap.insert(ele);
delete top;
}
else {
delete ele;
}
}
while (!Kheap.empty()) {
PrintHelperHeapItem *heap_item =
static_cast<PrintHelperHeapItem *>(Kheap.extractFirst());
if (!heap_item) {
HAGGLE_ERR("NULL heap item\n");
continue;
}
DataObjectUtilityMetadata *do_meta = heap_item->getMetadata();
if (!do_meta) {
HAGGLE_ERR("NULL data object metadata\n");
continue;
}
o_top10->push_front(do_meta);
delete heap_item;
}
}
开发者ID:SRI-CSL,项目名称:ENCODERS,代码行数:60,代码来源:CacheStrategyUtility.cpp
示例16: HAGGLE_ERR
bool ProtocolRFCOMM::initbase()
{
struct sockaddr_bt localAddr;
if (isConnected()) {
// Nothing to do
return true;
}
if (!openSocket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM, isServer())) {
HAGGLE_ERR("Could not create RFCOMM socket\n");
return false;
}
memset(&localAddr, 0, sizeof(struct sockaddr_bt));
localAddr.bt_family = AF_BLUETOOTH;
localAddr.bt_channel = channel & 0xff;
#ifndef OS_WINDOWS
if (localIface) {
BluetoothAddress *addr = localIface->getAddress<BluetoothAddress>();
if (addr) {
// Binding RFCOMM sockets to a hardware address does not
// seem to work in Windows
BDADDR_swap(&localAddr.bt_bdaddr, addr->getRaw());
}
}
#endif
if (isServer()) {
localAddr.bt_channel = channel & 0xff;
/* If this is a server we bing to a specific channel to listen on */
if (!bind((struct sockaddr *)&localAddr, sizeof(localAddr))) {
closeSocket();
#ifdef OS_WINDOWS
HAGGLE_ERR("Bind failed for local address WSA error=%s\n", StrError(WSAGetLastError()));
#endif
HAGGLE_ERR("Could not bind local address for RFCOMM socket\n");
return false;
}
HAGGLE_DBG("Bound RFCOMM server to channel=%d\n", channel);
} else {
HAGGLE_DBG("Created RFCOMM client on channel=%d\n", channel);
}
return true;
}
开发者ID:eikoyoneki,项目名称:haggle,代码行数:52,代码来源:ProtocolRFCOMM.cpp
示例17: deleteCallback
void deleteCallback(Event *e)
{
if (!e || !purger) {
HAGGLE_ERR("No event to delete callback\n");
return;
}
DataObjectRef dObj = e->getDataObject();
if (!dObj) {
HAGGLE_ERR("No data object\n");
return;
}
kernel->getDataStore()->deleteDataObject(dObj, purger->getKeepInBloomfilter());
}
开发者ID:SRI-CSL,项目名称:ENCODERS,代码行数:15,代码来源:CachePurgerRelTTL.cpp
示例18: HAGGLE_ERR
ProtocolEvent ProtocolUDPGeneric::sendData(
const void *buf,
size_t len,
const int flags,
size_t *bytes)
{
*bytes = 0;
int signed_size = static_cast<int>(len);
if (signed_size <= 0) {
HAGGLE_ERR("%s Cannot send file of invalid length %d\n", getName(), signed_size);
return PROT_EVENT_ERROR_FATAL;
}
size_t newLength = len + sizeof(udpmsg_t);
void *newBuff = malloc(newLength);
bzero(newBuff, newLength);
udpmsg_t *header = (udpmsg_t *)newBuff;
memcpy(header->session_no, nextSendSessionNo, sizeof(DataObjectId_t));
header->seq_no = nextSendSeqNo;
header->src_ip = srcIP;
header->dest_ip = destIP;
if (NULL == memcpy((void *)&(((char *)newBuff)[sizeof(udpmsg_t)]), buf, len)) {
HAGGLE_ERR("%s Could not create new buffer\n", getName());
return PROT_EVENT_ERROR_FATAL;
}
HAGGLE_DBG2("%s Sending packet with session no %s, sequence no %d, and size %d\n",
getName(),
DataObject::idString(nextSendSessionNo).c_str(),
nextSendSeqNo,
len);
ProtocolEvent pEvent;
ssize_t sbytes;
pEvent = sendHook(newBuff, newLength, flags, &sbytes);
if (sbytes < 0) {
free(newBuff);
return PROT_EVENT_ERROR;
}
*bytes = static_cast<size_t>(sbytes) - sizeof(udpmsg_t);
free(newBuff);
return pEvent;
}
开发者ID:SRI-CSL,项目名称:ENCODERS,代码行数:48,代码来源:ProtocolUDPGeneric.cpp
示例19: EVP_PKEY_new
bool Certificate::verifySignature(RSA *key)
{
bool res = false;
if (!key)
return false;
if (verified)
return true;
EVP_PKEY *pkey = EVP_PKEY_new();
if (!pkey) {
HAGGLE_ERR("Could not allocate EVP_PKEY\n");
writeErrors("");
return false;
}
EVP_PKEY_set1_RSA(pkey, key);
res = verifySignature(pkey);
EVP_PKEY_free(pkey);
return res;
}
开发者ID:SRI-CSL,项目名称:ENCODERS,代码行数:26,代码来源:Certificate.cpp
示例20: HAGGLE_DBG
bool ProtocolManager::registerProtocol(Protocol *p)
{
protocol_registry_t::iterator it;
if (!p)
return false;
// We are in shutdown, so do not accept this protocol to keep running.
if (getState() > MANAGER_STATE_RUNNING) {
p->shutdown();
if (!p->isDetached()) {
p->join();
HAGGLE_DBG("Joined with protocol %s\n", p->getName());
}
return false;
}
if (protocol_registry.insert(make_pair(p->getId(), p)).second == false) {
HAGGLE_ERR("Protocol %s already registered!\n", p->getName());
return false;
}
p->setRegistered();
HAGGLE_DBG("Protocol %s registered\n", p->getName());
return true;
}
开发者ID:eikoyoneki,项目名称:haggle-label,代码行数:28,代码来源:ProtocolManager.cpp
注:本文中的HAGGLE_ERR函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论