Tracking calls to close() when debugging

This commit is contained in:
Pierre Pronchery 2007-10-24 21:59:46 +00:00
parent ab87a78967
commit 4492c1757e
2 changed files with 21 additions and 0 deletions

View File

@ -109,6 +109,9 @@ static int _read_error(AppClient * ac)
SSL_shutdown(ac->ssl); SSL_shutdown(ac->ssl);
#endif #endif
close(ac->fd); /* FIXME is it really critical already? */ close(ac->fd); /* FIXME is it really critical already? */
#ifdef DEBUG
fprintf(stderr, "%s%d%s", "DEBUG: close(", ac->fd, ")\n");
#endif
ac->fd = -1; ac->fd = -1;
return 1; return 1;
} }
@ -286,7 +289,13 @@ void appclient_delete(AppClient * appclient)
{ {
appinterface_delete(appclient->interface); appinterface_delete(appclient->interface);
if(appclient->fd != -1) if(appclient->fd != -1)
{
close(appclient->fd); close(appclient->fd);
#ifdef DEBUG
fprintf(stderr, "%s%d%s", "DEBUG: close(", appclient->fd,
")\n");
#endif
}
#ifdef WITH_SSL #ifdef WITH_SSL
if(appclient->ssl != NULL) if(appclient->ssl != NULL)
SSL_free(appclient->ssl); SSL_free(appclient->ssl);

View File

@ -109,7 +109,13 @@ static void _appserverclient_delete(AppServerClient * appserverclient)
SSL_free(appserverclient->ssl); SSL_free(appserverclient->ssl);
#endif #endif
if(appserverclient->fd != -1) if(appserverclient->fd != -1)
{
close(appserverclient->fd); close(appserverclient->fd);
#ifdef DEBUG
fprintf(stderr, "%s%d%s", "DEBUG: close(", appserverclient->fd,
")\n");
#endif
}
free(appserverclient); free(appserverclient);
} }
@ -155,6 +161,9 @@ static int _appserver_accept(int fd, AppServer * appserver)
)) == NULL) )) == NULL)
{ {
close(newfd); close(newfd);
#ifdef DEBUG
fprintf(stderr, "%s%d%s", "DEBUG: close(", newfd, ")\n");
#endif
return 0; return 0;
} }
array_append(appserver->clients, &asc); array_append(appserver->clients, &asc);
@ -236,6 +245,9 @@ static int _read_logged(AppServer * appserver, AppServerClient * asc)
if(_appserver_receive(appserver, asc) != 0) if(_appserver_receive(appserver, asc) != 0)
{ {
close(asc->fd); close(asc->fd);
#ifdef DEBUG
fprintf(stderr, "%s%d%s", "DEBUG: close(", asc->fd, ")\n");
#endif
return 1; return 1;
} }
return 0; return 0;