Re: I have read and worked since 2 weeks ago

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Fri, 15 Jul 2011 04:00:06 +1200

On 13/07/11 22:22, Mohsen Pahlevanzadeh wrote:
> Dear all,
>
> I have read and examined source code of squid 2.7 with GDB since 2 weeks
> ago and i want to continue....Because i need to change squid source code
> and add features to it.May be i publish my code.

:( 2.7 has being declared end-of-life now. Will be obsoleted in a few
months.

If your changes are only small they might be ported to squid-3.
Otherwise if you are planning anthing that might be big, please start
with the 3.HEAD code. The data flow and layout are mosty the same, just
differences in object names.

> I have the following question, However i know this ML for contributor:
> 1. If i want to add a port and myself read and analyze my data,(separate
> form squid's data), how i do it? it mean What's algorithm of squid that
> i can use it?(which loop, thread or fork? [i didn't see any thread],did
> you rewrite C syscall and so on).....

Squid was written in multi-threaded design before thread syscalls
existed. Each "callback" function is a new thread segment within a whole
request transaction. I/O events from the OS are the 'thread' starting
points. Thousands of request transactions can happen in parallel since
they are all interleaved within one OS-level thread. Data is a shared
resource.

So, *everything* uses ports to drive the event threads. They all start
with a read/write/open/close/timer callback receiving data from somewhere.

So for a brand new type of port you must create handlers for all
relevant events. Each handler then uses whatever algorithms it needs to
produce its output.

Usually the *StateData objects you will see around Squid are the
component state engines created by an open() or start() event which link
the socket (FD) to all related handlers and data for that transaction.

> 2. For each func, we have 3 steps: a.definition. b. call. c. Data
> gathering.
> I have problem with Data gathering of squid.for instance, what do i fill
> StoryEntry data type variable?
> stroeComplete or storeRelease or many
> func use a set of data type that i have problem with them.i want to know
> where,when,and which variables are initialized that i handle a http page
> or http reply that it can store into storage.
>
> Yours,
> Mohsen
>

StoreEntry is the small pipe buffer through which large data streams
flow. (no joke).

whois.c has the simplest code for writing to one. ftp.c, http.c,
gopher.c, and store_*.c all have various other ways to do it. The
actual creating and setup code is buried deep in client_side.c and
involves copying meta data from the config file port settings and HTTP
request headers.

  So.. start with passing Squid storeEntryCreate() details from an HTTP
GET request ... um, sounds familiar?

I guess you are still trying to "push" data straight to the squid cache
despite advice to the contrary, true? So, why now?

Amos

-- 
Please be using
   Current Stable Squid 2.7.STABLE9 or 3.1.14
   Beta testers wanted for 3.2.0.9
Received on Thu Jul 14 2011 - 16:00:13 MDT

This archive was generated by hypermail 2.2.0 : Sat Jul 16 2011 - 12:00:05 MDT