Search squid archive

Re: A very low level question regarding performance of helpers.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/02/2014 8:12 p.m., Alan wrote:
> Hi Eliezer,
> 
> I know you have been testing fake helpers in a variety of languages.
> How about this one in C?
> Save it to helper-trivial.c and then compile it like this:
> gcc -O3 trivial.c -o trivial
> strip trivial
> 
> #include <unistd.h>
> int main(int argc, char *argv[]) {
> char in[256];
> char out[3] = "OK\n";
> while (1) {
> read(0, in, 256);
> write(1, out, 3);
> fsync(1);
> }
> }


This one will eventually hang and not exit after Squid disconnects. You
need the loop to be:
 do {
   ...
 } while (!feof(1));

NP: and helpers have to receive input lines of anywhere between 1KB and
32KB.

Amos




[Index of Archives]     [Linux Audio Users]     [Samba]     [Big List of Linux Books]     [Linux USB]     [Yosemite News]

  Powered by Linux