bug-commoncpp
[Top][All Lists]
Advanced

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

SocketService and SocketPort


From: Byrial Jensen
Subject: SocketService and SocketPort
Date: Sun, 29 Sep 2002 10:52:39 +0200
User-agent: Mutt/1.4i

Hi,

I have tried to use Commonn C++ to make a simple tcp proxy server,
and modelled my program over the tcpservice.cpp demo program.

However, my result is unstable, and I am trying to find out why.

It seems that the virtual callback functions of the SocketPort
class (expired, pending, output) should never delete the current
SocketPort object (*this) because SocketService::run will still
use a pointer (SocketPort *port) to the object /after/ the return
of these callback functions and thus use deallocated memory.

The tcpservice.cpp demo program have this problem for its
ChatterSession::expired and ChatterSession::pending functions.

I suggest that SocketService::run is rewritten to avoid to refer
to a SocketPort object if any of the callback functions deletes
the object. Or alternatively that the current restraints on the
functions is documented, and the demo program is rewritten to be
correct.

Another thing: I would like to use a SocketService to handle the
client end of tcp connections (because my proxy progam makes one
outgoing client connection for each incomming server connection),
but there is currently no way to create SocketPorts for this kind
of connections. I would like to suggest a new SocketPort
constructor which connects its socket a tcp server or throws an
execption if it cannot do that.

Best regards,
Byrial




reply via email to

[Prev in Thread] Current Thread [Next in Thread]