apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dagfinn Aarvaag" <dagfinn.aarv...@beepscience.com>
Subject RE: apr and pools
Date Thu, 02 May 2002 10:45:07 GMT
Hi,

we think we found some problems with the definition of the macros in the
errno.h file as you can see below.
The extra ")" ends the macro and leavs out the last line that also was ment
to be included.

We are also trying to check for a socket timeout. How should this be done?

Currently we got this code to work, but I had the imression that the correct
and portable way should
be to test for the APR return code APR_POLLUP instead of using
APR_STATUS_IS_ETIMEDOUT(apr)?


regards Dagfinn



/** Read data from socket to buffer starting at 'ptr', maximum 'max'
 *  bytes. Return the number of bytes read, -1 if socket fault and
 *  if no data could be read.
 *  @see setSoTimeout for setting of timeout/ blocking period. */
int32 TcpSocket::read(char* buf, int32 max)
{

   apr_size_t mLen = max;

   apr = apr_recvfrom(myAddr, mySock, 0, buf, &mLen);

  if (APR_STATUS_IS_ETIMEDOUT(apr)) {
      debug(" ---  Socket Timeout\n");
      return 0;
   }
   else if (apr != APR_SUCCESS) {
      fault = (fault != NULL) ? fault : new char[64];
      sprintf(fault,"Read fault on %s:%d, ", getLocalAddress(),
getLocalPort(),apr);
      uint8 len = strlen(fault);
      apr_strerror(apr, (fault+len), (63-len));
      debug(" ***  %d: %s\n", apr, fault);
      return  -1;
   }
   else
      return (int32) mLen;
}



errno.h updates >>>>>>>>>>>>>>>>>>>>>>>>>


cvs diff apr\include\apr_errno.h (in directory C:\cvsroot\cce\lib\)
Index: apr/include/apr_errno.h
===================================================================
RCS file: /usr/local/cvsroot/cce/lib/apr/include/apr_errno.h,v
retrieving revision 1.1.1.3
diff -r1.1.1.3 apr_errno.h
978c978
<                 || (s) == APR_OS_START_SYSERR + WSAETIMEDOUT) \
---
>                 || (s) == APR_OS_START_SYSERR + WSAETIMEDOUT \
1041c1041
<                 || (s) == APR_OS_START_SYSERR + WSAETIMEDOUT) \
---
>                 || (s) == APR_OS_START_SYSERR + WSAETIMEDOUT \
1083c1083
<                 || (s) == APR_OS_START_SYSERR + WSAETIMEDOUT) \
---
>                 || (s) == APR_OS_START_SYSERR + WSAETIMEDOUT \

*****CVS exited normally with code 1*****

-----Original Message-----
From: trawick@rdu88-250-166.nc.rr.com
[mailto:trawick@rdu88-250-166.nc.rr.com]On Behalf Of Jeff Trawick
Sent: 22. mars 2002 14:18
To: Dagfinn Aarvaag
Cc: dev@apr.apache.org
Subject: Re: apr and pools


"Dagfinn Aarvaag" <dagfinn.aarvaag@beepscience.com> writes:

> I have a problem with a growing memory pool when I create a server socket
> and accepts tcp connections on the server socket. It seams that the memory
> pool used for the server socket grows for each accepted tcp connection,
and
> that the memory is not released when the tcp socket is closed.
> I see the same problem both on Windows and Solaris.

You aren't passing the same pool to apr_accept(), are you?  Normally
you would have a temporary pool per connection, and pass that pool to
apr_accept().

If this doesn't help, try posting enough code to see how you are using
pools w.r.t. sockets.

--
Jeff Trawick | trawick@attglobal.net
Born in Roswell... married an alien...


Mime
View raw message