[DGD]Re: send_message() and message_done()

Par Winzell zell at skotos.net
Thu Oct 19 06:37:19 CEST 2000


Thomas,

As far as I understand, the behaviour changed as of 1.1.99:

 > When send_message(msg) == strlen(msg), then you can assume the message was
 > sent, and it is safe to call send_message() again.  message_done() will
 > not be called.

No, message_done() is now always called if there was any output
in the thread. This actually enabled me to simplify my own buffer
code so that the "ready" callback now always comes from the same
place (message_done), when the buffer is empty.

 > When send_message(msg) != strlen(msg), then there is some delay in sending
 > msg.  It is not safe to use send_message() again until message_done() is
 > called.  when message_done() is called, you can assume that the entire
 > message was sent (ie, you don't have to call
 > send_message(msg[bytes_sent..]), where bytes_sent is the return value of
 > the previous call to send_message), and can go on calling
 > send_message() as normal.

This is true -if- you use the kernel library which simulates the
old behaviour. However, if you are using DGD "raw", then you need
precisely the send_message(msg[bytes_sent ..]) trick you suggest.

Felix' post, for reference:

==================================================================
send_message() now returns the number of bytes it could store
in the output buffer (which is 64K large).  It does <not> buffer
more than that, so if the return value indicates that only part
of the string was buffered, you'll have to re-send the remainder
of the string, later.  The kernel library has been adjusted to
simulate the old behaviour.

message_done() is now called whenever the output buffer empties,
not just when it empties the first time after send_message()
indicated that it could only sent a partial string.
==================================================================


 > Also, how do I increase the maximum string length?

In src/config.h, do e.g.

-typedef unsigned short ssizet;
-# define SSIZET_MAX	USHRT_MAX
+typedef unsigned long ssizet;
+# define SSIZET_MAX	ULONG_MAX
 
-# define MAX_STRLEN	SSIZET_MAX	/* max string length, >= 65535 */
+# define MAX_STRLEN	1048576		/* max string length, >= 65535 */

and recompile.
 
Zell

List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list