[JDEV] Server modules

Thomas Charron tcharron at ductape.net
Tue Aug 28 11:56:20 CDT 2001


Quoting Glenn MacGregor <gtm at oracom.com>:
> I am writing a server module to answer certain iq namespace query's.  I
> need to malloc memory here for a file I am sending back over IM.

  Alrighty, but thats still kind of vague..  You reading in the file, and then 
going to add it as cdata to a tag in the result?

> First
> question, should I create a new jpacket or use the incoming and reset it
> (I need to hide nodes on that as well)?

  You could do pretty much what mod_time does, which is to use jutil_iqresult 
on the packet, set the namespace for the query, then reset the packet for 
delivery.  That way your reusing the already created tag, but up to you, 
really, either way will work, be it make a new one, or resuse the existing one..

> Second, When I malloc the mem,
> I get a server core dump in _pool_free.  I tried to use malloc and free
> and create a pool and use pmalloc and pool_free.  Neither seem to
> work?

  Need more data on this one, your question confuses me a bit.  Can you paste 
some psuedo code or snippets to show what you did that caused the core dump?

  Take a look at mod_time, which is a really good SHORT example of a module 
that replies to an iq message, it may help a bit if what you are doing is 
relativly simple..  Seems to me all it sounds like your doing is reading a 
file, and attaching it as a cdata segment, but that might not be what your 
trying to do..

--- 
Thomas Charron
<< Wanted: One decent sig >>
<< Preferably litle used  >>



More information about the JDev mailing list