本文整理汇总了C++中errh_Error函数的典型用法代码示例。如果您正苦于以下问题:C++ errh_Error函数的具体用法?C++ errh_Error怎么用?C++ errh_Error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了errh_Error函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: proc_Start
pwr_tStatus
proc_Start (
proc_sProcess *p
)
{
pwr_tStatus sts = PROC__SUCCESS;
char **argv;
p->pid = fork();
if (p->pid) {
if (p->pid == -1) {
errh_Error("Could not start %s, %m\nfile: %s", p->name, errno_GetStatus(), p->file);
} else {
errh_Info("Started %s, prio: %d, pid: %d\nfile: %s", p->name, p->p_prio, (int)p->pid, p->file);
}
} else {
sts = proc_SetPriority(p->p_prio);
if (EVEN(sts)) errh_Warning("%s: error setprio, %m\nfile: %s", p->name, sts, p->file);
argv = co_StrToArgv(p->file, p->arg);
execvp(p->file, argv);
errh_Error("%s: error execvp, %m\nfile: %s", p->name, errno_GetStatus(), p->file);
exit(EXIT_FAILURE);
}
return sts;
}
开发者ID:ManfredHerrmann,项目名称:proview,代码行数:26,代码来源:rt_proc.c
示例2: node
static gdb_sNode *
node (
net_sMessage *mp
)
{
pwr_tStatus sts;
gdb_sNode *np;
if (mp->nid == pwr_cNNodeId) {
errh_Error("Message from pwr_cNNodeId received");
return NULL;
}
gdb_ScopeLock {
np = hash_Search(&sts, gdbroot->nid_ht, &mp->nid);
} gdb_ScopeUnlock;
if (np == NULL) {
errh_Error("Message about unknown node: (%s) received\n",
cdh_NodeIdToString(NULL, mp->nid, 0, 0));
return NULL;
}
return np;
}
开发者ID:hfuhuang,项目名称:proview,代码行数:25,代码来源:rt_neth_acp.c
示例3: receive
static void *
receive (
qcom_sQid *qid,
qcom_sGet *get
)
{
pwr_tStatus sts;
void *mp;
for (;;) {
get->data = NULL;
/* Loop until receiving a valid message. */
mp = qcom_Get(&sts, &qcom_cQnacp, get, qcom_cTmoEternal);
if (mp == NULL) {
errh_Error("qcom_Get, %m", sts);
continue;
}
if (get->type.b == qcom_eBtype_event) {
event(get);
qcom_Free(&sts, mp);
continue;
}
else if (get->type.b != net_cMsgClass) {
errh_Error("Received bad message, type: <%d>, subtype: <%d>", get->type.b, get->type.s);
qcom_Free(&sts, mp);
continue;
}
return mp;
}
}
开发者ID:hfuhuang,项目名称:proview,代码行数:34,代码来源:rt_neth_acp.c
示例4: create_thread
static void
create_thread (
plc_sThread *tp,
plc_sProctbl *ptp,
plc_sProcess *pp
)
{
pwr_tStatus sts;
long int phase;
tp->aref.Objid = ptp->thread;
tp->init = ptp->init;
tp->exec = ptp->exec;
tp->first_scan = 1;
tp->PlcThread = pwrb_PlcThread_Init(&sts, tp);
tp->csup_lh = csup_Init(&sts, ptp->thread, tp->f_scan_time);
tp->i_scan_time = tp->f_scan_time * 1000.0 + 0.5;
time_FloatToD(&tp->scan_time, tp->f_scan_time);
tp->pp = pp;
plc_inittimer(tp);
tp->exit = FALSE;
link_io_copy_areas(tp);
que_Create(&sts, &tp->q_in);
que_Create(&sts, &tp->q_out);
sts = gdh_ObjidToName(ptp->thread, tp->name, sizeof(tp->name), cdh_mNName);
if (EVEN(sts)) {
errh_Error("Get name of thread object %s, %m", cdh_ObjidToString(NULL, ptp->thread, 1), sts);
return;
}
sts = gdh_ObjidToPointer(ptp->thread, (void *)&tp->PlcThread);
if (EVEN(sts)) {
errh_Error("Direct link to thread object \"%s\", %m", tp->name, sts);
return;
}
#if defined OS_LYNX && USE_RT_TIMER
sem_init(&tp->ScanSem, 0, 0);
tp->ScanMultiple = tp->i_scan_time / (CLK_TCK/1000);
tp->IntervalCount = tp->ScanMultiple;
#endif
sts = thread_Create(&tp->tid, tp->name, (void *(*)())&plc_thread, tp);
if (EVEN(sts)) {
errh_Error("Creating thread \"%s\", %m", tp->name, sts);
return;
}
/* Wait for thread to initialize. */
phase = (long int)que_Get(&sts, &tp->q_out, NULL, NULL);
pwr_Assert(phase == 1);
}
开发者ID:hfuhuang,项目名称:proview,代码行数:60,代码来源:rt_plc_process.c
示例5: IoCardWrite
static pwr_tStatus IoCardWrite( io_tCtx ctx,
io_sAgent *ap,
io_sRack *rp,
io_sCard *cp)
{
io_sLocalSPI_Slave *local = (io_sLocalSPI_Slave *)cp->Local;
pwr_sClass_SPI_Slave *op = (pwr_sClass_SPI_Slave *)cp->op;
int sts;
int i;
io_bus_card_write( ctx, cp, local->output_area,
local->byte_ordering, pwr_eFloatRepEnum_FloatIEEE);
// sts = write( local->fd, local->output_area, local->output_area_size);
for ( i = 0; i < local->output_area_size; i++) {
sts = write( local->fd, &local->output_area[i], 1);
if ( sts != 1)
break;
}
if ( sts < 0) {
op->ErrorCount++;
if ( !local->writeerror_logged) {
errh_Error( "SPI write error errno %d, '%s'", errno, cp->Name);
local->writeerror_logged = 1;
}
op->Status = IOM__SPI_WRITEERROR;
}
// else if ( sts != local->output_area_size) {
else if ( sts == 0) {
op->ErrorCount++;
if ( !local->writeerror_logged) {
errh_Error( "SPI write buffer unexpected size %d, '%s'", sts, cp->Name);
local->writeerror_logged = 1;
}
op->Status = IOM__SPI_WRITEERROR;
}
else {
local->writeerror_logged = 0;
op->Status = IOM__SPI_NORMAL;
}
if ( op->ErrorSoftLimit &&
op->ErrorCount == op->ErrorSoftLimit && !local->softlimit_logged) {
errh_Warning( "IO Card ErrorSoftLimit reached, '%s'", cp->Name);
local->softlimit_logged = 1;
}
if ( op->ErrorHardLimit && op->ErrorCount >= op->ErrorHardLimit) {
errh_Error( "IO Card ErrorHardLimit reached '%s', IO stopped", cp->Name);
ctx->Node->EmergBreakTrue = 1;
return IO__ERRDEVICE;
}
return IO__SUCCESS;
}
开发者ID:Strongc,项目名称:proview,代码行数:54,代码来源:rt_io_m_spi_slave.c
示例6: AoRangeToCoef
static pwr_tStatus AoRangeToCoef(
io_sChannel *chanp)
{
pwr_sClass_ChanAo *cop;
char buf[120];
pwr_tStatus sts;
int i;
pwr_tFloat32 PolyCoef1;
pwr_tFloat32 PolyCoef0;
cop = chanp->cop;
if ( cop)
{
cop->CalculateNewCoef = 0;
/* Coef for ActualValue to RawValue conversion */
if ( cop->ActValRangeHigh != cop->ActValRangeLow)
{
cop->SigValPolyCoef1 = (cop->SensorSigValRangeHigh - cop->SensorSigValRangeLow)/
(cop->ActValRangeHigh - cop->ActValRangeLow);
cop->SigValPolyCoef0 = cop->SensorSigValRangeHigh - cop->ActValRangeHigh *
cop->SigValPolyCoef1;
}
else
{
sts = gdh_ObjidToName( chanp->ChanObjid, buf, sizeof(buf),
cdh_mName_volumeStrict);
if ( EVEN(sts)) return sts;
errh_Error( "Invalid ActValueRange in Ao channel %s", buf);
return IO__CHANRANGE;
}
/* Coef for ActualValue to SignalValue conversion */
if ( cop->ChannelSigValRangeHigh != 0)
{
PolyCoef0 = 0;
PolyCoef1 = 2047. / cop->ChannelSigValRangeHigh;
cop->OutPolyCoef1 = cop->SigValPolyCoef1 * PolyCoef1;
cop->OutPolyCoef0 = PolyCoef0 + PolyCoef1*
cop->SigValPolyCoef0;
}
else
{
sts = gdh_ObjidToName( chanp->ChanObjid, buf, sizeof(buf),
cdh_mName_volumeStrict);
if ( EVEN(sts)) return sts;
errh_Error( "Invalid SigValueRange in Ao channel %s", buf);
return IO__CHANRANGE;
}
}
return IO__SUCCESS;
}
开发者ID:hfuhuang,项目名称:proview,代码行数:52,代码来源:rt_io_m_ao_7455_20.c
示例7: lockMountServers
static void lockMountServers(gdb_sNode* np)
{
pwr_tStatus sts;
pool_sQlink* msl;
pool_sQlink* vl;
gdb_sVolume* vp;
gdb_sMountServer* msp;
gdb_sObject* op;
gdb_AssumeLocked;
for (vl = pool_Qsucc(NULL, gdbroot->pool, &np->own_lh); vl != &np->own_lh;
vl = pool_Qsucc(NULL, gdbroot->pool, vl)) {
vp = pool_Qitem(vl, gdb_sVolume, l.own_ll);
if (vl->self == vl->flink) {
/* Connection lost and volume removed from own list */
errh_Error("Volume not owned any more, %s", vp->g.name.orig);
return;
}
if (!vp->l.flags.b.isConnected) {
/* !!! Todo !!! How do we make this known ? */
errh_Error("Volume not connected, %s", vp->g.name.orig);
continue;
}
for (msl = pool_Qsucc(NULL, gdbroot->pool, &vp->l.volms_lh);
msl != &vp->l.volms_lh; msl = pool_Qsucc(NULL, gdbroot->pool, msl)) {
msp = pool_Qitem(msl, gdb_sMountServer, volms_ll);
op = hash_Search(&sts, gdbroot->oid_ht, &msp->oid);
if (op == NULL) {
op = cvolc_OidToObject(
&sts, vp, msp->oid, vol_mTrans_none, cvol_eHint_none);
if (op == NULL) {
errh_Error("Can't fetch the mount server's object, %s",
cdh_ObjidToString(msp->oid, 0));
/* !!! Todo !!! How do we make this error known ? */
continue;
}
}
msp->msor = pool_ItemReference(NULL, gdbroot->pool, op);
op->l.flags.b.isMountServer = 1;
if (msp->nodms_ll.self == msp->nodms_ll.flink
&& msp->nodms_ll.self == msp->nodms_ll.blink)
pool_QinsertPred(NULL, gdbroot->pool, &msp->nodms_ll, &np->nodms_lh);
/* if (0)
errh_Info("Locking object %s", op->g.f.name.orig); */
cvolc_LockObject(&sts, op);
}
}
}
开发者ID:siamect,项目名称:proview,代码行数:52,代码来源:rt_neth_acp.c
示例8: status_check
static bool status_check(pwr_sClass_Hilscher_cifX_PnController* op,
io_sAgent* ap, int sts, const char* text)
{
if (sts == CIFX_NO_ERROR)
return true;
xDriverGetErrorDescription(sts, op->ErrorStr, sizeof(op->ErrorStr));
op->Status = sts;
if (text)
errh_Error("IO init %s, '%s', %s", ap->Name, op->ErrorStr, text);
else
errh_Error("IO init %s, '%s'", ap->Name, op->ErrorStr);
return false;
}
开发者ID:siamect,项目名称:proview,代码行数:14,代码来源:rt_io_m_hilscher_cifx_pncontroller.cpp
示例9: IoRackInitSwap
/*----------------------------------------------------------------------------*\
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoRackInitSwap(io_tCtx ctx, io_sAgent* ap, io_sRack* rp)
{
io_sRackLocal* local;
pwr_sClass_Ssab_RemoteRack* op;
int sts;
op = (pwr_sClass_Ssab_RemoteRack*)rp->op;
local = calloc(1, sizeof(*local));
rp->Local = local;
/* Create socket, store in local struct */
local->s = socket(AF_INET, SOCK_DGRAM, 0);
if (local->s < 0) {
errh_Error(
"Error creating socket for IO remote rack %s, %d", rp->Name, local->s);
op->Status = IO__INITFAIL;
return IO__ERRINIDEVICE;
}
/* Initialize remote address structure */
local->rem_addr.sin_family = AF_INET;
local->rem_addr.sin_port = htons(op->RemotePort);
local->rem_addr.sin_addr.s_addr = inet_addr((char*)&(op->Address));
/* Connect to remote address */
sts = connect(
local->s, (struct sockaddr*)&local->rem_addr, sizeof(local->rem_addr));
if (sts != 0) {
errh_Error(
"Error binding remote socket for IO remote rack %s, %d", rp->Name, sts);
op->Status = IO__INITFAIL;
return IO__ERRINIDEVICE;
}
local->next_read_req_item = 0;
local->next_write_req_item = 0;
op->RX_packets = 0;
op->TX_packets = 0;
/* Log initialization */
errh_Info("Init of IO remote rack %s/%s:%d", rp->Name,
inet_ntoa(local->rem_addr.sin_addr), ntohs(local->rem_addr.sin_port));
op->Status = IO__NORMAL;
return IO__SUCCESS;
}
开发者ID:siamect,项目名称:proview,代码行数:53,代码来源:rt_io_m_ssab_remoterack.c
示例10: stop_threads
static void
stop_threads (
plc_sProcess *pp
)
{
pwr_tInt32 i;
pwr_tStatus sts;
plc_sThread *tp;
for (i = 0, tp = pp->thread; i < pp->thread_count ; i++, tp++) {
tp->exit = TRUE;
/* Tell thread it is time for phase 4, stop. */
#if defined OS_LYNX && USE_RT_TIMER
sem_post(&tp->ScanSem);
#else
que_Put(&sts, &tp->q_in, &tp->event, (void *)4);
#endif
#if 0
pwr_tStatus t_sts;
sts = thread_Join(&tp->tid, &t_sts);
if (EVEN(sts))
errh_Error("thread_Join, thread %n, %m", tp->name, sts);
#endif
}
}
开发者ID:hfuhuang,项目名称:proview,代码行数:28,代码来源:rt_plc_process.c
示例11: main
int main()
{
pwr_tStatus sts;
rt_sysmon sysmon;
int tmo;
char mp[2000];
qcom_sQid qid = qcom_cNQid;
qcom_sGet get;
int swap = 0;
bool first_scan = true;
init( &qid);
try {
sysmon.open();
}
catch ( co_error& e) {
errh_Error( (char *)e.what().c_str());
errh_Fatal( "rt_sysmon aborting");
errh_SetStatus( PWR__SRVTERM);
exit(0);
}
aproc_TimeStamp( sysmon.scantime(), 5);
errh_SetStatus( PWR__SRUN);
first_scan = true;
for (;;) {
if ( first_scan) {
tmo = (int) (sysmon.scantime() * 1000 - 1);
}
get.maxSize = sizeof(mp);
get.data = mp;
qcom_Get( &sts, &qid, &get, tmo);
if (sts == QCOM__TMO || sts == QCOM__QEMPTY) {
if ( !swap)
sysmon.scan();
}
else {
ini_mEvent new_event;
qcom_sEvent *ep = (qcom_sEvent*) get.data;
new_event.m = ep->mask;
if (new_event.b.oldPlcStop && !swap) {
errh_SetStatus( PWR__SRVRESTART);
swap = 1;
sysmon.close();
} else if (new_event.b.swapDone && swap) {
swap = 0;
sysmon.open();
errh_SetStatus( PWR__SRUN);
} else if (new_event.b.terminate) {
exit(0);
}
}
first_scan = false;
}
}
开发者ID:ManfredHerrmann,项目名称:proview,代码行数:60,代码来源:rt_sysmon.cpp
示例12: IoAgentWrite
static pwr_tStatus IoAgentWrite(io_tCtx ctx, io_sAgent* ap)
{
io_sLocalHilscher_cifX_PnController* local
= (io_sLocalHilscher_cifX_PnController*)ap->Local;
pwr_sClass_Hilscher_cifX_PnController* op
= (pwr_sClass_Hilscher_cifX_PnController*)ap->op;
int32_t sts;
if (local->output_area_size) {
sts = xChannelIOWrite(
local->chan, 0, 0, local->output_area_size, local->output_area, 10);
op->Status = sts;
if (sts != CIFX_NO_ERROR) {
if (!local->dev_init) {
op->ErrorCount++;
xDriverGetErrorDescription(sts, op->ErrorStr, sizeof(op->ErrorStr));
}
if (op->ErrorCount == op->ErrorSoftLimit && !local->softlimit_logged) {
errh_Error("IO Error soft limit reached on agent '%s'", ap->Name);
local->softlimit_logged = 1;
}
if (op->ErrorCount >= op->ErrorHardLimit) {
ctx->Node->EmergBreakTrue = 1;
return IO__ERRDEVICE;
}
}
}
return IO__SUCCESS;
}
开发者ID:siamect,项目名称:proview,代码行数:30,代码来源:rt_io_m_hilscher_cifx_pncontroller.cpp
示例13: IoAgentInit
static pwr_tStatus IoAgentInit( io_tCtx ctx,
io_sAgent *ap)
{
io_sLocalUSB_Agent *local;
int sts;
pwr_sClass_USB_Agent *op = (pwr_sClass_USB_Agent *)ap->op;
local = (io_sLocalUSB_Agent *) calloc( 1, sizeof(io_sLocalUSB_Agent));
ap->Local = local;
sts = libusb_init( &local->libusb_ctx);
if ( sts != 0) {
if ( sts == io_cLibDummy)
op->Status = IO__DUMMYBUILD;
else
op->Status = IO__INITFAIL;
errh_Error( "Init of USB agent failed '%s', error status %d", ap->Name, sts);
local->libusb_ctx = 0;
return op->Status;
}
else {
op->Status = IO__SUCCESS;
errh_Info( "Init of USBIO agent '%s'", ap->Name);
}
return IO__SUCCESS;
}
开发者ID:ManfredHerrmann,项目名称:proview,代码行数:28,代码来源:rt_io_m_usb_agent.c
示例14: ini_PlcStart
pwr_tStatus
ini_PlcStart (
pwr_tUInt32 plcversion,
char *plcfile,
pwr_tUInt32 busid
)
{
pwr_tUInt32 sts;
unsigned int flags;
char command[128];
char procname[20];
$DESCRIPTOR(commanddsc, "");
$DESCRIPTOR(procnamedsc, "");
commanddsc.dsc$a_pointer = command;
commanddsc.dsc$w_length = sprintf(command, "run %s", plcfile);
procnamedsc.dsc$a_pointer = procname;
procnamedsc.dsc$w_length = sprintf(procname, "PWR_PLC_%d", busid);
flags = 1; /* Nowait and Notify */
sts = lib$spawn(&commanddsc, NULL, NULL, &flags, &procnamedsc);
if (EVEN(sts)) errh_Error("lib$spawn %s\n%m", command, sts);
return sts;
}
开发者ID:hfuhuang,项目名称:proview,代码行数:25,代码来源:ini_loader.c
示例15: IoAgentSwap
/*----------------------------------------------------------------------------*\
Swap method for the Pb_profiboard agent
\*----------------------------------------------------------------------------*/
static pwr_tStatus IoAgentSwap (
io_tCtx ctx,
io_sAgent *ap,
io_eEvent event
)
{
switch ( event) {
case io_eEvent_IoCommSwapInit:
case io_eEvent_IoCommSwap: {
pwr_sClass_Pb_Profiboard *op;
char DeviceName[64];
io_sAgentLocal *local;
if (ap->Local == NULL) {
/* Allocate area for local data structure */
ap->Local = calloc(1, sizeof(io_sAgentLocal));
if (!ap->Local) {
errh_Error( "ERROR swap init Profibus DP Master %s - %s", ap->Name, "calloc");
return IO__ERRINIDEVICE;
}
local = (io_sAgentLocal *) ap->Local;
errh_Info( "Swap init interface for Profibus DP Master %s", ap->Name);
op = (pwr_sClass_Pb_Profiboard *) ap->op;
sprintf(DeviceName, "/dev/pbboard%u", op->BusNumber - 1);
local->hDpsBoardDevice = open(DeviceName, O_RDONLY | O_NONBLOCK);
if (local->hDpsBoardDevice == -1) {
errh_Error( "ERROR swap init Profibus DP Master %s - %s", ap->Name, "open");
return IO__ERRINIDEVICE;
}
}
break;
}
case io_eEvent_EmergencyBreak:
case io_eEvent_IoCommEmergencyBreak:
IoAgentClose( ctx, ap);
break;
}
return IO__SUCCESS;
}
开发者ID:Strongc,项目名称:proview,代码行数:50,代码来源:rt_io_m_pb_profiboard.c
示例16: sect_InitLock
pwr_tBoolean
sect_InitLock (
pwr_tStatus *sts,
sect_sHead *shp,
sect_sMutex *mp
)
{
pwr_tStatus lsts = 1;
#ifdef OS_ELN
ELN$INITIALIZE_AREA_LOCK((AREA)shp->area, *mp, &lsts);
#elif defined(OS_VMS)
{
pwr_tUInt32 i;
/* Clear mutex variable and build free list. */
memset(mp, 0, sizeof(*mp));
lsts = sys$ascefc(64, &shp->namedsc, 0, 0);
if (ODD(lsts)) {
for (i=0; i<32; i++) {
while (_INSQTI(&mp->list[i].entry, &mp->freeroot) == 1);
mp->list[i].flag = 64+i;
lsts = sys$clref(mp->list[i].flag);
if (EVEN(lsts)) break;
}
}
}
#elif defined(OS_LYNX)
if (sem_init(mp, 1, 1) != 0) {
errh_Error("sect_InitLock: sem_init, errno: %d", errno);
lsts = 2;
}
#elif defined OS_POSIX
if (posix_sem_init_shared(mp, ftok(shp->name, 'P'), 1) != 0) {
errh_Error("sect_InitLock: sem_init(%s), errno: %d", shp->name, errno);
lsts = 2;
}
#endif
errh_ReturnOrBugcheck(ODD(lsts), sts, lsts, "");
}
开发者ID:jordibrus,项目名称:proview,代码行数:44,代码来源:rt_sect.c
示例17: cmd_check
static bool cmd_check(pwr_sClass_Hilscher_cifX_PnController* op, io_sAgent* ap,
unsigned int cmd1, unsigned int cmd2)
{
if (cmd1 == cmd2)
return true;
strcpy(op->ErrorStr, "Unexpected message received");
errh_Error("IO init %s, '%s'", ap->Name, op->ErrorStr);
return false;
}
开发者ID:siamect,项目名称:proview,代码行数:10,代码来源:rt_io_m_hilscher_cifx_pncontroller.cpp
示例18: errh_Error
JNIEXPORT void JNICALL Java_jpwr_rt_Errh_error
(JNIEnv *env, jobject object, jstring jmsg)
{
char *cstr;
const char *msg;
msg = (*env)->GetStringUTFChars( env, jmsg, 0);
cstr = (char *)msg;
errh_Error( cstr);
(*env)->ReleaseStringUTFChars( env, jmsg, cstr);
}
开发者ID:ManfredHerrmann,项目名称:proview,代码行数:12,代码来源:jpwr_rt_Errh.c
示例19: clean_all
static void
clean_all (
plc_sProcess *pp
)
{
pwr_tStatus sts;
sts = gdh_UnrefObjectInfoAll();
if (EVEN(sts))
errh_Error("gdh_UnrefObjectInfoAll, %m", sts);
}
开发者ID:hfuhuang,项目名称:proview,代码行数:12,代码来源:rt_plc_process.c
示例20: rmq_send
unsigned int rmq_send(remnode_item* remnode, pwr_sClass_RemTrans* remtrans,
char* buf, int buf_size)
{
int sts;
amqp_basic_properties_t prop;
amqp_bytes_t msg;
char* tmpbuf;
unsigned int tmpbuf_size;
if (rn_rmq->DisableHeader) {
msg.bytes = buf;
msg.len = buf_size;
} else {
tmpbuf_size = sizeof(rabbit_header) + buf_size;
tmpbuf = malloc(tmpbuf_size);
memcpy(tmpbuf + sizeof(rabbit_header), buf, buf_size);
((rabbit_header*)tmpbuf)->msg_size = htons(tmpbuf_size);
((rabbit_header*)tmpbuf)->msg_id[0] = htons(remtrans->Address[0]);
((rabbit_header*)tmpbuf)->msg_id[1] = htons(remtrans->Address[1]);
msg.bytes = tmpbuf;
msg.len = tmpbuf_size;
}
if ( remtrans->Address[3] == 2)
prop.delivery_mode = 2;
else
prop.delivery_mode = 1;
prop._flags = AMQP_BASIC_DELIVERY_MODE_FLAG;
// 0 mandatory 0 immediate
if (!streq(ctx->op->Exchange, ""))
sts = amqp_basic_publish(ctx->conn, ctx->channel,
amqp_cstring_bytes(ctx->op->Exchange), amqp_cstring_bytes(""), 0, 0,
&prop, msg);
else
sts = amqp_basic_publish(ctx->conn, ctx->channel,
amqp_cstring_bytes(ctx->op->Exchange),
amqp_cstring_bytes(ctx->op->SendQueue), 0, 0, &prop, msg);
if (sts) {
remtrans->ErrCount++;
errh_Error("Send failed, queue %s, RabbitMQ status %d",
rn_rmq->SendQueue, sts, 0);
if (debug)
printf("Send failed sts:%d\n", (int)sts);
}
if (!rn_rmq->DisableHeader)
free(tmpbuf);
return STATUS_OK;
}
开发者ID:siamect,项目名称:proview,代码行数:52,代码来源:rs_remote_rabbitmq.c
注:本文中的errh_Error函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论