Re: Introduction

From: Serassio Guido <>
Date: Sat, 30 Apr 2005 10:46:37 +0200

Hi Evgeny,

At 00.40 30/04/2005, Evgeny Kotsuba wrote:
>You make me laugh. squid2.5 use read/write/send/recv/ etc. as well as
>It seems the same things are in squid3.
>With classes we have only read/write/open/close to any handle and can
>control it in single place.
>Why you don't see "bytes_read += rc;" that is fd_bytes() and that is
>one more function call etc. ?

Please, stop here :-)

I don't wrote that your solution is wrong, or that C++ classes are bad. I
wrote that your solution is slower.

I have removed similar things some time ago from the Windows port for poor
performance reasons.

On both Windows and OS/2 we have the problem that File handles and Socket
handles are not equivalent for I/O function calls, when Squid code use
generic file descriptor for both types. FD_READ_METHOD/FD_WRITE_METHOD is a
simple and efficient method to solve this problem, probably not the better.

On Windows there is another problem, I don't know if this is true on OS/2 too:
Sockets handles returned from socket() and accept() are not mapped in the
MS C runtime internal file descriptor table, so it should not possible to
use a fd_table like Squid does, because value of returned disk FD and
socket handles are not related. With some tricks this problem was avoided,
but this workaround is the cause of the current 2048 FD limit in the
Windows port. There is another side effect: any socket function call on
Windows must be encapsulated to do a translation from C Runtime FD to Win32
socket handle.

For the first problem a good C++ solution could be to have something like a
FileDescriptor class, with create(), read(), write(), close(), etc
SPECIALIZED action in place of READ_HANDLER/WRITE_HANDLER, that we call as, fd.write(), etc. This is very close to your fde::read()
approach, but without any decision in the code.

But this is not enough, because don't solve the second problem. Here the
solution could be the usage of something like a Squid_Socket class with all
socket calls encapsulation.



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
Received on Sat Apr 30 2005 - 02:47:01 MDT

This archive was generated by hypermail pre-2.1.9 : Sun May 01 2005 - 12:00:06 MDT