trafficserver-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shaun mcginnity <shaun.mcginn...@gmail.com>
Subject Re: API Question
Date Fri, 15 Mar 2013 14:09:12 GMT
Hi Steve,

TSVConnWrite initiates a write operation on the transform's downstream
VConnection. The last parameter is the total amount of data you are going
to write. INT64_MAX is effectively unlimited.

When you have data to write you get the VIO's buffer
(TSVIOBufferGet(output_vio)), and copy the data into it. Then the VIO is
reenabled. Reenabling the VIO causes an IMMEDIATE event to be sent to the
VIO's VConnection. When the VConnection's event handler has finished with
the data it will call your continuation back. If it expects you to send
more data it will pass a WRITE_READY event. If you have given the VIO the
total amount of data as set in TSVConnWrite it will call you back with a
WRITE_COMPLETE event. This behaviour is the same as what the transform
should do to its input VIO.

Since the downstream VConnection is the client and / or cache, if you do a
finite write, i.e. not INT64_MAX, then the HTTP transaction will close when
the limit is reached. Issuing another write in this case will probably not
work. You can do multiple writes on a NetVConnection though, e.g. as
provided by TSNetConnect.

Hope that helps.

Shaun



-----Original Message-----

From: James Peach [mailto:jpeach@apache.org <jpeach@apache.org>]

Sent: Friday, March 15, 2013 3:12 AM

To: users@trafficserver.apache.org

Subject: Re: API Question



On 14/03/2013, at 5:13 PM, "Owens, Steve" <Steve.Owens@disney.com> wrote:



> In looking at the following documentation:
http://trafficserver.apache.org/docs/trunk/sdk/io-guide/transformations.en.html

>

> It would seem that the only mention of TSVConnWrite is to a single
parameter method.

>

> Yet in my plugin I am using

>

> data->output_vio = TSVConnWrite(output_conn, contp, data->output_reader,

>                                 INT64_MAX);

>

> What has changed about this method?

>

> What does it actually do?



It schedules data to be written to the VConnection.



>

> Do I need to call it every time the plugin is re-enabled?  Or can I just
call it once?



I don't know that I really understand the question, but if the length is
INT64_MAX you would only call it once. If you want you can call it a
multiple times with shorter lengths.



J

Mime
View raw message