Re: CRT fd limitation in Squid NT port

From: Serassio Guido <guido.serassio@dont-contact.us>
Date: Tue, 05 Jul 2005 21:55:38 +0200

Hi Andrey,

At 21.22 05/07/2005, Andrey Shorin wrote:

>Hello Guido,
>
> I've been thinking about the problem for a while. Here is what comes
> to mind.
>
> The only way to leave out CRT fd number limitation is to give up CRT
> use for files and sockets operations. On the other hand, code change
> to the source tree should be minimal.

I agree: MS CRT is too limited and the impact in the source code
should be minimal.

>Say, add one or two headers
> and a .cc file. From that, here is an idea:
>
> We could implement a class, say, FileDescriptor. Then we derive FDfile,
> FDtcp, FDpipe & FDudp from it (or whatever fd kind is needed).
> FileDescriptor class should have pure virtual methods for write,
> read, open, connect etc. Then we have functions like
>
>__inline int
>write(FileDescriptor& fd, const void *buffer, unsigned int count) {
> return fd.write(buffer, count);
>}
>
>int FDtcp::write(const void *buffer, unsigned int count)
>{
> return ::send(fh /* member of FileDescriptor */,
> buffer, count, 0);
>}
>
>int FDfile::write(const void *buffer, unsigned int count)
>{
> DWORD cbWritten;
>
> if ( WriteFile(fh, buffer, count, &cbWritten, NULL ) {
> return cbWritten;
> } else {
> ...
> }
>}
>
> This way, the source tree would remain mostly unchanged and squid
> won't have that 2048 fd limitation.

I think that changes should be deeper: My opinion is that we should
remove any direct reference to FD concept creating a virtualized
interface between Squid and the OS.
And this isn't a so simple thing to do ... :-(

> I haven't write something in C++ for quite a while. So I'm not sure
> if the idea would work at all ;) May be template thing should be
> used, which I'm not too familar with :) (but will read about it).

My C++ knowledge is very limited too. I'm still looking, without
success for now, for someone that could help me on this work.

Regards

Guido

-
========================================================
Guido Serassio
Acme Consulting S.r.l. - Microsoft Certified Partner
Via Lucia Savarino, 1 10098 - Rivoli (TO) - ITALY
Tel. : +39.011.9530135 Fax. : +39.011.9781115
Email: guido.serassio@acmeconsulting.it
WWW: http://www.acmeconsulting.it/
Received on Tue Jul 05 2005 - 13:56:12 MDT

This archive was generated by hypermail pre-2.1.9 : Mon Aug 01 2005 - 12:00:03 MDT