本文整理汇总了C++中BAIL_ON_ERROR函数的典型用法代码示例。如果您正苦于以下问题:C++ BAIL_ON_ERROR函数的具体用法?C++ BAIL_ON_ERROR怎么用?C++ BAIL_ON_ERROR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了BAIL_ON_ERROR函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: sr_Over
void sr_Over(cpu_t *pcpu, decode_t *pdecoded) {
uint32_t tmp1 = pop(pcpu);
uint32_t tmp2 = pop(pcpu);
BAIL_ON_ERROR();
push(pcpu, tmp2);
push(pcpu, tmp1);
push(pcpu, tmp2);
}
开发者ID:NextGenIntelligence,项目名称:interpreters-comparison,代码行数:8,代码来源:subroutined.c
示例2: lwmsg_peer_task_run_connect
static
LWMsgStatus
lwmsg_peer_task_run_connect(
LWMsgPeer* peer,
PeerAssocTask* task,
LWMsgTaskTrigger trigger,
LWMsgTaskTrigger* next_trigger,
LWMsgTime* next_timeout
)
{
LWMsgStatus status = LWMSG_STATUS_SUCCESS;
status = lwmsg_assoc_connect(task->assoc, (LWMsgSession*) task->session);
switch (status)
{
case LWMSG_STATUS_SUCCESS:
task->type = PEER_TASK_DISPATCH;
BAIL_ON_ERROR(status = lwmsg_peer_log_connect(task));
/* Set up the fd the assoc just created for events */
BAIL_ON_ERROR(status = lwmsg_task_set_trigger_fd(task->event_task, CONNECTION_PRIVATE(task->assoc)->fd));
break;
case LWMSG_STATUS_PENDING:
task->type = PEER_TASK_FINISH_CONNECT;
/* Even if the connect pended, the fd is now available. Set it up for events */
BAIL_ON_ERROR(status = lwmsg_task_set_trigger_fd(task->event_task, CONNECTION_PRIVATE(task->assoc)->fd));
/* Restore status code */
status = LWMSG_STATUS_PENDING;
lwmsg_peer_task_set_timeout(peer, task, &peer->timeout.establish, trigger, next_trigger, next_timeout);
break;
default:
BAIL_ON_ERROR(status = lwmsg_peer_task_handle_assoc_error(
peer,
task,
status));
break;
}
done:
return status;
error:
goto done;
}
开发者ID:bhanug,项目名称:likewise-open,代码行数:46,代码来源:peer-task.c
示例3: lwmsg_peer_task_finish_transceive
static
LWMsgStatus
lwmsg_peer_task_finish_transceive(
LWMsgPeer* peer,
PeerAssocTask* task
)
{
LWMsgStatus status = LWMSG_STATUS_PENDING;
LWMsgMessage* message = NULL;
while ((!task->recv_blocked && task->incoming) ||
(!task->send_blocked && task->outgoing))
{
status = lwmsg_assoc_finish(task->assoc, &message);
switch (status)
{
case LWMSG_STATUS_SUCCESS:
if (message == &task->incoming_message)
{
task->incoming = LWMSG_FALSE;
task->recv_partial = LWMSG_FALSE;
BAIL_ON_ERROR(status = lwmsg_peer_task_dispatch_incoming_message(task));
}
else if (message == &task->outgoing_message)
{
lwmsg_peer_log_message(task, &task->outgoing_message, LWMSG_FALSE);
task->outgoing = LWMSG_FALSE;
if (task->destroy_outgoing)
{
lwmsg_assoc_destroy_message(task->assoc, &task->outgoing_message);
task->destroy_outgoing = LWMSG_FALSE;
}
}
break;
case LWMSG_STATUS_PENDING:
lwmsg_peer_task_update_blocked(task);
break;
default:
BAIL_ON_ERROR(status);
}
}
error:
return status;
}
开发者ID:bhanug,项目名称:likewise-open,代码行数:46,代码来源:peer-task.c
示例4: lwmsg_peer_new
LWMsgStatus
lwmsg_peer_new(
const LWMsgContext* context,
LWMsgProtocol* protocol,
LWMsgPeer** out_peer
)
{
LWMsgStatus status = LWMSG_STATUS_SUCCESS;
LWMsgPeer* peer = NULL;
BAIL_ON_ERROR(status = LWMSG_ALLOC(&peer));
lwmsg_ring_init(&peer->connect_endpoints);
lwmsg_ring_init(&peer->listen_endpoints);
memset(&peer->timeout, 0xFF, sizeof(peer->timeout));
peer->context = context;
BAIL_ON_ERROR(status = lwmsg_status_map_errno(pthread_mutex_init(&peer->lock, NULL)));
peer->lock_init = LWMSG_TRUE;
BAIL_ON_ERROR(status = lwmsg_status_map_errno(pthread_cond_init(&peer->event, NULL)));
peer->event_init = LWMSG_TRUE;
BAIL_ON_ERROR(status = lwmsg_task_acquire_manager(&peer->task_manager));
BAIL_ON_ERROR(status = lwmsg_task_group_new(peer->task_manager, &peer->connect_tasks));
peer->max_clients = 100;
peer->max_backlog = 8;
peer->protocol = protocol;
*out_peer = peer;
done:
return status;
error:
if (peer)
{
lwmsg_peer_delete(peer);
}
goto done;
}
开发者ID:bhanug,项目名称:likewise-open,代码行数:46,代码来源:peer.c
示例5: lwmsg_data_unmarshal_indirect
static LWMsgStatus
lwmsg_data_unmarshal_indirect(
LWMsgDataContext* context,
LWMsgUnmarshalState* state,
LWMsgTypeIter* iter,
LWMsgTypeIter* inner,
LWMsgBuffer* buffer,
unsigned char* object,
size_t count
)
{
LWMsgStatus status = LWMSG_STATUS_SUCCESS;
size_t i;
unsigned char* element = NULL;
if ((inner->kind == LWMSG_KIND_INTEGER ||
inner->kind == LWMSG_KIND_ENUM) &&
inner->info.kind_integer.width == 1 &&
inner->size == 1)
{
/* If the element type is an integer and the packed and unpacked sizes are both 1,
then we can copy directly from the marshalled data into the object. This
is an important optimization for unmarshalling character strings */
BAIL_ON_ERROR(status = lwmsg_buffer_read(buffer, object, count * inner->size));
}
else
{
/* Otherwise, we need to unmarshal each element individually */
element = object;
for (i = 0; i < count; i++)
{
BAIL_ON_ERROR(status = lwmsg_data_unmarshal_internal(
context,
state,
inner,
buffer,
element));
element += inner->size;
}
}
error:
return status;
}
开发者ID:bhanug,项目名称:likewise-open,代码行数:46,代码来源:data-unmarshal.c
示例6: VecsCreateCertStoreA
void client::AddTrustedRoot(
std::string Cert)
{
DWORD dwError = 0;
PVECS_STORE pStore = NULL;
dwError = VecsCreateCertStoreA(
(PSTR) ServerName.c_str(),
TRUSTED_ROOTS_STORE_NAME,
NULL,
&pStore);
if (dwError == ERROR_ALREADY_EXISTS)
{
dwError = VecsOpenCertStoreA(
(PSTR) ServerName.c_str(),
TRUSTED_ROOTS_STORE_NAME,
NULL,
&pStore);
}
BAIL_ON_ERROR(dwError);
dwError = VecsAddEntryA(
pStore,
CERT_ENTRY_TYPE_TRUSTED_CERT,
NULL,
(PSTR) Cert.c_str(),
NULL,
NULL,
0);
if (dwError == ERROR_ALREADY_EXISTS)
{
dwError = 0;
}
BAIL_ON_ERROR(dwError);
cleanup:
if (pStore)
{
VecsCloseCertStore(pStore);
}
return;
error:
THROW_IF_NEEDED(dwError);
goto cleanup;
}
开发者ID:vmware,项目名称:lightwave,代码行数:46,代码来源:afdclient.cpp
示例7: lwmsg_assoc_print_message_alloc
LWMsgStatus
lwmsg_assoc_print_message_alloc(
LWMsgAssoc* assoc,
LWMsgMessage* message,
char** result
)
{
LWMsgStatus status = LWMSG_STATUS_SUCCESS;
LWMsgDataContext* context = NULL;
LWMsgTypeSpec* type = NULL;
LWMsgBuffer buffer = {0};
const char* tag_name = NULL;
unsigned char nul = 0;
buffer.wrap = realloc_wrap;
buffer.data = (void*) &assoc->context;
BAIL_ON_ERROR(status = lwmsg_data_context_new(&assoc->context, &context));
BAIL_ON_ERROR(status = lwmsg_protocol_get_message_name(assoc->prot, message->tag, &tag_name));
BAIL_ON_ERROR(status = lwmsg_protocol_get_message_type(assoc->prot, message->tag, &type));
if (type)
{
BAIL_ON_ERROR(status = lwmsg_buffer_print(&buffer, "%s: ", tag_name));
BAIL_ON_ERROR(status = lwmsg_data_print_graph(
context,
type,
message->data,
4,
&buffer));
BAIL_ON_ERROR(status = lwmsg_buffer_write(&buffer, &nul, 1));
}
else
{
BAIL_ON_ERROR(status = lwmsg_buffer_print(&buffer, "%s", tag_name));
}
*result = (char*) buffer.base;
cleanup:
if (context)
{
lwmsg_data_context_delete(context);
}
return status;
error:
*result = NULL;
if (buffer.base)
{
lwmsg_context_free(&assoc->context, buffer.base);
}
goto cleanup;
}
开发者ID:FarazShaikh,项目名称:LikewiseSMB2,代码行数:60,代码来源:assoc.c
示例8: lwmsg_archive_read_message_wrap_fd
static
LWMsgStatus
lwmsg_archive_read_message_wrap_fd (
LWMsgBuffer* buffer,
size_t needed
)
{
LWMsgStatus status = LWMSG_STATUS_SUCCESS;
readinfo* info = buffer->data;
LWMsgArchive* archive = info->archive;
size_t count = 0;
if (needed)
{
/* Read next block of data from file */
if (info->remaining == 0)
{
/* The message was longer than the length specified in the header */
BAIL_ON_ERROR(status = LWMSG_STATUS_MALFORMED);
}
else
{
BAIL_ON_ERROR(status = lwmsg_archive_read_fd(
archive,
info->data,
info->remaining > sizeof(info->data) ? sizeof(info->data) : info->remaining,
&count));
info->remaining -= count;
buffer->end = buffer->base + count;
buffer->cursor = buffer->base;
}
}
else
{
if (info->remaining != 0)
{
/* The message was shorter than the length specified in the header */
BAIL_ON_ERROR(status = LWMSG_STATUS_MALFORMED);
}
}
error:
return status;
}
开发者ID:bhanug,项目名称:likewise-open,代码行数:45,代码来源:archive-format.c
示例9: LwSmTableGetEntryReverseDependencyClosure
DWORD
LwSmTableGetEntryReverseDependencyClosure(
PSM_TABLE_ENTRY pEntry,
PWSTR** pppwszServiceList
)
{
DWORD dwError = 0;
PWSTR* ppwszServiceList = NULL;
PWSTR* ppwszAllServices = NULL;
dwError = LwAllocateMemory(sizeof(*ppwszServiceList) * 1, OUT_PPVOID(&ppwszServiceList));
BAIL_ON_ERROR(dwError);
dwError = LwSmTableEnumerateEntries(&ppwszAllServices);
BAIL_ON_ERROR(dwError);
dwError = LwSmTableGetEntryReverseDependencyClosureHelper(
pEntry,
ppwszAllServices,
&ppwszServiceList);
BAIL_ON_ERROR(dwError);
*pppwszServiceList = ppwszServiceList;
cleanup:
if (ppwszAllServices)
{
LwSmFreeStringList(ppwszAllServices);
}
return dwError;
error:
*pppwszServiceList = NULL;
if (ppwszServiceList)
{
LwSmFreeStringList(ppwszServiceList);
}
goto cleanup;
}
开发者ID:twistround,项目名称:pbis,代码行数:44,代码来源:table.c
示例10: LwSmTableStartRecursive
static
DWORD
LwSmTableStartRecursive(
PSM_TABLE_ENTRY pEntry
)
{
DWORD error = 0;
PSM_TABLE_ENTRY pOtherEntry = NULL;
PWSTR* ppServices = NULL;
DWORD index = 0;
/* Start all dependencies */
error = LwSmTableGetEntryDependencyClosure(pEntry, &ppServices);
BAIL_ON_ERROR(error);
for (index = 0; ppServices[index]; index++)
{
error = LwSmTableGetEntry(ppServices[index], &pOtherEntry);
BAIL_ON_ERROR(error);
error = LwSmTableStartEntry(pOtherEntry);
BAIL_ON_ERROR(error);
LwSmTableReleaseEntry(pOtherEntry);
pOtherEntry = NULL;
}
error = LwSmTableStartEntry(pEntry);
BAIL_ON_ERROR(error);
error:
if (ppServices)
{
LwSmFreeStringList(ppServices);
}
if (pOtherEntry)
{
LwSmTableReleaseEntry(pOtherEntry);
}
return error;
}
开发者ID:twistround,项目名称:pbis,代码行数:44,代码来源:table.c
示例11: LwSmConfigureLogging
static
DWORD
LwSmConfigureLogging(
PCSTR pszProgramName
)
{
DWORD dwError = 0;
LwSmLoggingInit(pszProgramName);
if (gState.logLevel == 0)
{
if (gState.bStartAsDaemon || (gState.bContainer && !gState.pGroup))
{
gState.logLevel = LW_SM_LOG_LEVEL_WARNING;
}
else
{
gState.logLevel = LW_SM_LOG_LEVEL_VERBOSE;
}
}
LwSmSetMaxLogLevel(NULL, gState.logLevel);
if (gState.pszLogFilePath)
{
dwError = LwSmSetLoggerToPath(NULL, gState.pszLogFilePath);
BAIL_ON_ERROR(dwError);
}
else if (gState.bSyslog)
{
dwError = LwSmSetLoggerToSyslog(NULL);
BAIL_ON_ERROR(dwError);
}
else
{
dwError = LwSmSetLoggerToFile(NULL, stderr);
BAIL_ON_ERROR(dwError);
}
error:
return dwError;
}
开发者ID:bhanug,项目名称:likewise-open,代码行数:44,代码来源:main.c
示例12: lwmsg_data_unmarshal_indirect_prologue
/* Find or unmarshal the length of a pointer or array */
static LWMsgStatus
lwmsg_data_unmarshal_indirect_prologue(
LWMsgDataContext* context,
LWMsgUnmarshalState* state,
LWMsgTypeIter* iter,
LWMsgTypeIter* inner,
LWMsgBuffer* buffer,
size_t* out_count
)
{
LWMsgStatus status = LWMSG_STATUS_SUCCESS;
unsigned char temp[4];
switch (iter->info.kind_indirect.term)
{
case LWMSG_TERM_STATIC:
/* Static lengths are easy */
*out_count = iter->info.kind_indirect.term_info.static_length;
break;
case LWMSG_TERM_MEMBER:
/* The length is present in a member we have already unmarshalled */
BAIL_ON_ERROR(status = lwmsg_data_extract_length(
iter,
state->dominating_object,
out_count));
break;
case LWMSG_TERM_ZERO:
/* The length is present in the data stream as an unsigned 32-bit integer */
BAIL_ON_ERROR(status = lwmsg_buffer_read(buffer, temp, sizeof(temp)));
BAIL_ON_ERROR(status = lwmsg_convert_integer(
temp,
sizeof(temp),
context->byte_order,
out_count,
sizeof(*out_count),
LWMSG_NATIVE_ENDIAN,
LWMSG_UNSIGNED));
break;
}
error:
return status;
}
开发者ID:bhanug,项目名称:likewise-open,代码行数:45,代码来源:data-unmarshal.c
示例13: IdmJsonToPasswordResetRequestData
SSOERROR
IdmJsonToPasswordResetRequestData(
PCSSO_JSON pJson,
IDM_PASSWORD_RESET_REQUEST_DATA** ppPasswordResetRequest)
{
SSOERROR e = SSOERROR_NONE;
IDM_PASSWORD_RESET_REQUEST_DATA* pPasswordResetRequest = NULL;
if (pJson == NULL || ppPasswordResetRequest == NULL)
{
e = SSOERROR_INVALID_ARGUMENT;
BAIL_ON_ERROR(e);
}
e = SSOMemoryAllocate(sizeof(IDM_PASSWORD_RESET_REQUEST_DATA), (void**) &pPasswordResetRequest);
BAIL_ON_ERROR(e);
e = RestJsonToData(
pJson,
REST_JSON_OBJECT_TYPE_STRING,
NULL,
"currentPassword",
(void**) &(pPasswordResetRequest->currentPassword));
BAIL_ON_ERROR(e);
e = RestJsonToData(
pJson,
REST_JSON_OBJECT_TYPE_STRING,
NULL,
"newPassword",
(void**) &(pPasswordResetRequest->newPassword));
BAIL_ON_ERROR(e);
*ppPasswordResetRequest = pPasswordResetRequest;
error:
if (e != SSOERROR_NONE)
{
IdmPasswordResetRequestDataDelete(pPasswordResetRequest);
}
return e;
}
开发者ID:vmware,项目名称:lightwave,代码行数:44,代码来源:password_reset_request_data.c
示例14: LwSmQueryServiceReverseDependencyClosure
DWORD
LwSmQueryServiceReverseDependencyClosure(
LW_SERVICE_HANDLE hHandle,
PWSTR** pppwszServiceList
)
{
DWORD dwError = 0;
PWSTR* ppwszServiceList = NULL;
PWSTR* ppwszAllServices = NULL;
dwError = LwAllocateMemory(sizeof(*ppwszServiceList) * 1, OUT_PPVOID(&ppwszServiceList));
BAIL_ON_ERROR(dwError);
dwError = LwSmEnumerateServices(&ppwszAllServices);
BAIL_ON_ERROR(dwError);
dwError = LwSmQueryServiceReverseDependencyClosureHelper(
hHandle,
ppwszAllServices,
&ppwszServiceList);
BAIL_ON_ERROR(dwError);
*pppwszServiceList = ppwszServiceList;
cleanup:
if (ppwszAllServices)
{
LwSmFreeStringList(ppwszAllServices);
}
return dwError;
error:
*pppwszServiceList = NULL;
if (ppwszServiceList)
{
LwSmFreeStringList(ppwszServiceList);
}
goto cleanup;
}
开发者ID:bhanug,项目名称:likewise-open,代码行数:44,代码来源:client.c
示例15: ConvertAnsitoUnicodeString
DWORD
ConvertAnsitoUnicodeString(
PCSTR pszSrc,
PWSTR* ppwszDst
)
{
DWORD dwError = 0;
#ifdef _WIN32
PSTR pszNewString = NULL;
#endif
if (!pszSrc || !ppwszDst)
{
dwError = ERROR_INVALID_PARAMETER;
}
else
{
#ifdef _WIN32
// allocate space for new string then pass addr to output
// double the original PSTR size for WPSTR
ULONG srcLen = (ULONG)strlen(pszSrc)+1;
ULONG destLen = (srcLen+1)*2;
dwError = VMCAAllocateMemory((DWORD) destLen, (PVOID*)&pszNewString);
BAIL_ON_ERROR(dwError);
if (0 == MultiByteToWideChar(CP_ACP, 0, pszSrc, -1, (LPWSTR)pszNewString, destLen))
{
dwError = GetLastError();
BAIL_ON_ERROR(dwError);
}
*ppwszDst = (LPWSTR)pszNewString;
cleanup:
return dwError;
error:
VMCAFreeMemory(pszNewString);
goto cleanup;
#else
dwError = LwNtStatusToWin32Error(
LwRtlWC16StringAllocateFromCString(ppwszDst, pszSrc));
#endif
}
return dwError;
}
开发者ID:Dan-McGee,项目名称:lightwave,代码行数:44,代码来源:memory.c
示例16: VMCAASN1ToTimeT
DWORD
VMCAASN1ToTimeT(
ASN1_TIME *pTime,
time_t *ptmTime
)
{
/* Time format is either YYmmddHHMMSS or YYYYmmddHHMMSS */
DWORD dwError = 0;
struct tm time1;
int ndx = 0;
const char *tmstring = (const char *) pTime->data;
if(tmstring == NULL) {
dwError = VMCA_CRL_NULL_TIME;
BAIL_ON_ERROR(dwError);
}
memset(&time1, 0, sizeof(time1));
// Two digit year
if(pTime->type == V_ASN1_UTCTIME) {
time1.tm_year = (tmstring[ndx++] - '0') * 10;
time1.tm_year += tmstring[ndx++] - '0';
if( time1.tm_year < 70) {
time1.tm_year += 100;
}
} else if ( pTime->type == V_ASN1_GENERALIZEDTIME){
// Four digit year
time1.tm_year = (tmstring[ndx++] - '0') * 1000;
time1.tm_year += (tmstring[ndx++] - '0') * 100;
time1.tm_year += (tmstring[ndx++] - '0') * 10;
time1.tm_year += (tmstring[ndx++] - '0') * 1;
time1.tm_year -=1900;
}
time1.tm_mon = (tmstring[ndx++] - '0') * 10;
time1.tm_mon += (tmstring[ndx++] - '0') - 1;
time1.tm_mday = (tmstring[ndx++] - '0') * 10;
time1.tm_mday += (tmstring[ndx++] - '0');
time1.tm_hour = (tmstring[ndx++] - '0') * 10;
time1.tm_hour += (tmstring[ndx++] - '0');
time1.tm_min = (tmstring[ndx++] - '0') * 10;
time1.tm_min +=(tmstring[ndx++] - '0');
time1.tm_sec = (tmstring[ndx++] - '0') * 10;
time1.tm_sec +=(tmstring[ndx++] - '0');
// Ignoring Z +hh 'mm' for time1 being.
*ptmTime = mktime(&time1);
error :
return dwError;
}
开发者ID:Dan-McGee,项目名称:lightwave,代码行数:56,代码来源:pkcs_crl.c
示例17: VMCABackupRootCAFiles
DWORD
VMCABackupRootCAFiles(
PCSTR pszRootCACertFile,
PCSTR pszRootCAPrivateKeyFile,
PCSTR pszRootCAPasswordFile
)
{
DWORD dwError = ERROR_SUCCESS;
dwError = VMCABackupFiles(pszRootCACertFile);
BAIL_ON_ERROR(dwError);
dwError = VMCABackupFiles(pszRootCAPrivateKeyFile);
BAIL_ON_ERROR(dwError);
dwError = VMCABackupFiles(pszRootCAPasswordFile);
BAIL_ON_ERROR(dwError);
error:
return dwError;
}
开发者ID:Dan-McGee,项目名称:lightwave,代码行数:19,代码来源:certutils.c
示例18: sr_Mod
void sr_Mod(cpu_t *pcpu, decode_t *pdecoded) {
uint32_t tmp1 = pop(pcpu);
uint32_t tmp2 = pop(pcpu);
BAIL_ON_ERROR();
if (tmp2 == 0) {
pcpu->state = Cpu_Break;
return;
}
push(pcpu, tmp1 % tmp2);
}
开发者ID:NextGenIntelligence,项目名称:interpreters-comparison,代码行数:10,代码来源:subroutined.c
示例19: ConvertUnicodetoAnsiString
DWORD
ConvertUnicodetoAnsiString(
PCWSTR pwszSrc,
PSTR* ppszDst
)
{
DWORD dwError = 0;
#ifdef _WIN32
PSTR pszNewString = NULL;
#endif
if (!pwszSrc || !ppszDst)
{
dwError = ERROR_INVALID_PARAMETER;
}
else
{
#ifdef _WIN32
ULONG srcLen = (ULONG)wcslen(pwszSrc)+1;
ULONG destLen = srcLen*2;
dwError = VMCAAllocateMemory((DWORD) destLen, (PVOID*)&pszNewString);
BAIL_ON_ERROR(dwError);
if (0 == WideCharToMultiByte(CP_ACP, 0, pwszSrc, -1, pszNewString, destLen, NULL, NULL ))
{
dwError = GetLastError();
BAIL_ON_ERROR(dwError);
}
*ppszDst = pszNewString;
cleanup:
return dwError;
error:
VMCAFreeMemory(pszNewString);
goto cleanup;
#else
dwError = LwNtStatusToWin32Error(
LwRtlCStringAllocateFromWC16String(ppszDst, pwszSrc));
#endif
}
return dwError;
}
开发者ID:Dan-McGee,项目名称:lightwave,代码行数:43,代码来源:memory.c
示例20: lwmsg_peer_connect_fd
LWMsgStatus
lwmsg_peer_connect_fd(
LWMsgPeer* peer,
LWMsgEndpointType type,
int fd,
LWMsgSession** session
)
{
LWMsgStatus status = LWMSG_STATUS_SUCCESS;
LWMsgBool locked = LWMSG_FALSE;
PeerEndpoint* endpoint = NULL;
BAIL_ON_ERROR(status = LWMSG_ALLOC(&endpoint));
endpoint->fd = fd;
endpoint->type = type;
PEER_LOCK(peer, locked);
if (peer->connect_session)
{
BAIL_ON_ERROR(status = LWMSG_STATUS_INVALID_STATE);
}
BAIL_ON_ERROR(status = lwmsg_peer_session_new(peer, &peer->connect_session));
peer->connect_session->endpoint = endpoint;
endpoint = NULL;
if (session)
{
*session = (LWMsgSession*) peer->connect_session;
}
error:
PEER_UNLOCK(peer, locked);
if (endpoint)
{
free(endpoint);
}
return status;
}
开发者ID:bhanug,项目名称:likewise-open,代码行数:43,代码来源:peer.c
注:本文中的BAIL_ON_ERROR函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论