[Libwebsockets] recent changes breaking DomTerm

Andy Green andy at warmcat.com
Thu Jan 25 02:16:03 CET 2018



On 25/01/18 09:05, Andy Green wrote:

> I guess your HEAD (3623ee96eb6c0ab552483ca14d1919fcfe81d874) doesn't 
> have whatever fix you made for the actual back-to-back write that you 
> mentioned you fixed up, because it still blows there.  But the backtrace 
> shows it's inside the WRITABLE callback suggesting it's a real problem.

This kind of thing won't fly (write_to_browser calls lws_write())

                 write_to_browser(wsi, p, strlen(p), false);
                 if (pclient->saved_window_contents != NULL) {
                   int rcount = pclient->preserved_sent_count;
                   char *buf = 
xmalloc(strlen(pclient->saved_window_contents)+40);
                   sprintf(buf+LWS_PRE,
                           URGENT_START_STRING "\033]103;%d,%s\007" 
URGENT_END_STRING,
                           pclient->preserved_sent_count,
                           pclient->saved_window_contents);
                   int rlen = strlen(buf+LWS_PRE);
                   write_to_browser(wsi, buf+LWS_PRE, rlen, false);
...

if it's common more than one case will want to write, I suggest you 
concatenate them into the tx buffer and then write once at the end if 
anything wrote in the tx buffer.  Otherwise you can only send one and 
ask for another writable callback if you detect something more to do.

-Andy



More information about the Libwebsockets mailing list