[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[Libevent-users] free bufferevents on all data is sent in filters chain
- To: libevent-users@xxxxxxxxxxxxx
- Subject: [Libevent-users] free bufferevents on all data is sent in filters chain
- From: Artem <ru.netz@xxxxxxxxx>
- Date: Thu, 06 Feb 2014 11:42:42 -0800
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: libevent-users-outgoing@xxxxxxxx
- Delivered-to: libevent-users@xxxxxxxx
- Delivery-date: Thu, 06 Feb 2014 14:42:49 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=qWfDf//RDDu43YZjfrloQPFVN2Yq7dfg3k6Jw7uqjs4=; b=iK7y4bOip3ALrptMXZ741nK3jdKfAYLmmxekhIE/fsv3OCGI+yRGtd6WcRS83cnrJo YQo14pwCSxqfjL9ny3CgGLsLdWzWBoqlOzRJiL2DqWGsJmL9dem5KMxIdzAilj5mu2Oa ZiQesMOObbxGXOBZv+uqNUV+90BnKQoIlnQKw47hWOLjekkFuW0rIWaS0DEZWz34KfvL Xh2Uj6Dujm9HYgPXzTlsJKroGk7pRm69u5S+3B1uGSrKNGKudjpKDLEgS1GRL+K7j6W/ m9blM9dWR4H33jfV/iHPU3/SKThRlgmc2KHuOj2cCC6DQSPENtbUtAm7D9vvJAMqFQRX M58w==
- Reply-to: libevent-users@xxxxxxxxxxxxx
- Sender: owner-libevent-users@xxxxxxxxxxxxx
- User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0
Greetings,
I'm trying to understand how to properly free bufferevents when all data
is finished sending using filters chain.
I.e. I have one bufferevent and bufferevent_filter on top of it. I'm
writing some data into filter, and on some event I'm deciding that all
data is sent and I want to close it. If I close it immediately with
bufferevent_free I'll loose data that is in output_buffer, but is not
sent to the client. I there is no filter I'm setting write callback and,
there I check if there is still data in output_buffer and call
bufferevent_free if it's empty. With filters it doesn't work because
filter write_callback is called when underlying buffer can accept data
AND there is data in filter buffer (BEV_NORMAL), so if there is no data
in filter buffer, but there is some in underlying buffer, it will not be
called.
To fix this there should be got_out_eof in struct
bufferevent_filtered, that should be set when bufferevent_flush is
called with EV_WRITE, after that be_filter_process_output should call
user write callback no mater what. After that in user write callback we
check if all output buffers in filters chain are empty and if yes, then
free the filter bufferent. Am I missing something?
Artem Germanov.
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users in the body.