Hey all, I'm trying to create a out of process transform plugin that's a bit like server-transform.c.
It connects to a server over a socket and sends it the data from the origin server along with some metadata provided from a database. However, I'm having trouble writing to the transform server VIO the second time. My first write succeeds, my second never appears on the other process. In fact, it never crosses the wire according to tcpdump. In a callback after TSNetConnect() I can do a TSVConnWrite() successfully, but in a callback later on the TSVConnWrite() appears to succeed, but no data goes over the wire. Here's the most interesting part of the code: // ***INIT_CALLBACK: Fire off the connection TSNetConnect( cont, (const struct sockaddr *)server_address ); // Returns 0x3 // ***TS_EVENT_NET_CONNECT: Send the initial request data to the transform server TSVConn server_vc = vc; // Saved for later TSIOBuffer server_write_buf = TSIOBufferCreate(); // Also saved for later TSIOBufferReader server_write_buf_reader = TSIOBufferReaderAlloc( self->server_write_buf ); // Also saved for later gchar *request = g_strdup_printf( "GET /index.html HTTP/1.1\r\n\r\n" ); // Create the request TSIOBufferWrite( server_write_buf, request_location, len ) // Write our request into it the buffer TSVConnWrite( server_vc, cont, server_write_buf_reader, strlen( request ) ); // Ask it to send the data to the server // This works - that data is sent across the wire // ***TS_EVENT_VCONN_WRITE_READY: when data is received from the origin server TSVIO origin_vio = TSVConnWriteVIOGet( cont ); gint64 towrite = TSVIONTodoGet( origin_vio ); TSIOBufferReader origin_reader = TSVIOReaderGet( origin_vio ); // Works, and returns around about the right amount of data TSIOBufferCopy( server_write_buf, origin_reader, towrite, 0 ) // DOESN'T WORK: Send the data to the server_write_buf created above TSVIOReenable( server_write_vio ); // Saved earlier // Consume the data from the origin server, etc. This seems to read the right amount of data from the origin server, however, the data is never send out the transformation VIO. If I do a If I do a TSVConnWrite() here instead of TSIOBufferCopy it also doesn't work. I'm guessing that I've missed something important when dealing with VIO and Vconnections. Is there something else I need to call to get the vconnection to *actually* send data across the wire? I thought TSVIOReenable() was enough. The testing server is a simple python script that creates a basic event-driven echo and append server. Cheers, John Rowe