-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Serassio Guido wrote:
> 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.

You might look for inspiration at the ACE (Adaptive Communication
Environment) project, which is full of useful patterns for C++
programming around / across the "systems programmming" spectrum:

 http://www.cs.wustl.edu/~schmidt/ACE.html

The library includes abstractions which cross the POSIX / Win32 API
boundaries for all sorts of interesting problems.


Tres.
- --
===================================================================
Tres Seaver          +1 202-558-7113          [EMAIL PROTECTED]
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCyuwN+gerLs4ltQ4RAvv2AJ9SKgYByJLrPd6Duc7y8sVW3y23cgCgvFXq
PKnj/4La6xgR46pSGYwkPnE=
=M++8
-----END PGP SIGNATURE-----

Reply via email to