I’m working on a resource manager. I want to be able to receive ANY
message not otherwise trapped by the resource manager architecture. I
have added code such as:
- an other_callback()
- resmgr_attr.other_func = other_callback;
resmgr_attr.flags |= RESMGR_FLAG_ATTACH_OTHERFUNC;
All of my messages receive via the message_attach() work fine.
But I’m not getting any of the other messages in my other_callback.
What am I missing?
Code fragments are below.
BTW, from the “main loop woke up” line I can see that I am receiving
something when I receive an otherwise invalid message. (That’s good!)
But I can also see that I’m receiving 2 somethings when the client does
the close(). Why 2 messages?
=================
int other_callback ( resmgr_context_t *ctp, void *msg )
{
printf( “Server Got OTHER Message\n” );
return 0;
}
int main ( )
{
resmgr_attr_t resmgr_attr;
message_attr_t message_attr;
dispatch_context_t *ctp, *ctp_ret;
. . .
resmgr_attr.other_func = other_callback;
resmgr_attr.flags |= RESMGR_FLAG_ATTACH_OTHERFUNC;
. . .
resmgr_id = resmgr_attach( dpp, &resmgr_attr, “/my_service”,
_FTYPE_ANY, 0, &ConnectFuncs, &IoFuncs, &IoFuncAttr );
. . .
message_id = message_attach( dpp, &message_attr,
_IO_MAX + 1,_IO_MAX + 6, message_callback, NULL );
. . .
for(;
{
ctp_ret = dispatch_block( ctp );
if( ctp_ret )
{
printf( “main loop woke up\n” );
ctp = ctp_ret;
dispatch_handler( ctp );
}
else
{
fprintf( stderr, “dispatch_block() failed: %s\n”, strerror( errno ) );
return EXIT_FAILURE;
}
}
}
Bill Caroselli <qtps@earthlink.net> wrote:
I’m working on a resource manager. I want to be able to receive ANY
message not otherwise trapped by the resource manager architecture. I
have added code such as:
- an other_callback()
- resmgr_attr.other_func = other_callback;
resmgr_attr.flags |= RESMGR_FLAG_ATTACH_OTHERFUNC;
All of my messages receive via the message_attach() work fine.
But I’m not getting any of the other messages in my other_callback.
What am I missing?
What message types are you sending?
Code fragments are below.
BTW, from the “main loop woke up” line I can see that I am receiving
something when I receive an otherwise invalid message. (That’s good!)
But I can also see that I’m receiving 2 somethings when the client does
the close(). Why 2 messages?
IO_CLOSE message and disconnect pulse, maybe?
for(;
{
ctp_ret = dispatch_block( ctp );
if( ctp_ret )
{
printf( “main loop woke up\n” );
In here, try printing out the message type, and maybe some other
information… like rcvid, client’s pid, etc.
ctp = ctp_ret;
dispatch_handler( ctp );
}
else
{
fprintf( stderr, “dispatch_block() failed: %s\n”, strerror( errno ) );
return EXIT_FAILURE;
}
}
}
-David
QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.
Bill Caroselli <qtps@earthlink.net> wrote:
I’m working on a resource manager. I want to be able to receive ANY
message not otherwise trapped by the resource manager architecture. I
have added code such as:
message_attach() with MSG_FLAG_DEFAULT_FUNC will do what you want.
chris
–
Chris McKillop <cdm@qnx.com> “The faster I go, the behinder I get.”
Software Engineer, QSSL – Lewis Carroll –
http://qnx.wox.org/
Chris McKillop <cdm@qnx.com> wrote:
CM > Bill Caroselli <qtps@earthlink.net> wrote:
I’m working on a resource manager. I want to be able to receive ANY
message not otherwise trapped by the resource manager architecture. I
have added code such as:
CM > message_attach() with MSG_FLAG_DEFAULT_FUNC will do what you want.
CM > chris
Thank you very much Chris. This appears to be what I want.
What is the intended purpose of:
resmgr_attr.other_func = other_callback;
resmgr_attr.flags |= RESMGR_FLAG_ATTACH_OTHERFUNC;
?
Thank you very much Chris. This appears to be what I want.
What is the intended purpose of:
resmgr_attr.other_func = other_callback;
resmgr_attr.flags |= RESMGR_FLAG_ATTACH_OTHERFUNC;
Dunno. Never used that before.
chris
–
Chris McKillop <cdm@qnx.com> “The faster I go, the behinder I get.”
Software Engineer, QSSL – Lewis Carroll –
http://qnx.wox.org/
Bill Caroselli <qtps@earthlink.net> wrote:
Chris McKillop <> cdm@qnx.com> > wrote:
CM > Bill Caroselli <> qtps@earthlink.net> > wrote:
I’m working on a resource manager. I want to be able to receive ANY
message not otherwise trapped by the resource manager architecture. I
have added code such as:
CM > message_attach() with MSG_FLAG_DEFAULT_FUNC will do what you want.
CM > chris
Thank you very much Chris. This appears to be what I want.
What is the intended purpose of:
resmgr_attr.other_func = other_callback;
resmgr_attr.flags |= RESMGR_FLAG_ATTACH_OTHERFUNC;
?
message_attach() requires the dispatch_* framework, rather than
the resmgr_* framework – this may be a “throwback” to that older
framework, that has been superceded by the newer dispatch_*
framework.
-David
QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.