Merge pull request #6006 from rgerhards/revert-pr-5806

tcpsrv: revert PR 5806 because it was ineffective
This commit is contained in:
Rainer Gerhards 2025-08-22 12:46:59 +02:00 committed by GitHub
commit 21c9164a4b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 13 deletions

View File

@ -68,8 +68,6 @@ BEGINobjConstruct(tcps_sess) /* be sure to specify the object type also in END m
pThis->inputState = eAtStrtFram; /* indicate frame header expected */
pThis->eFraming = TCP_FRAMING_OCTET_STUFFING; /* just make sure... */
pthread_mutex_init(&pThis->mut, NULL);
pThis->being_closed = 0;
INIT_ATOMIC_HELPER_MUT(pThis->mut_being_closed);
/* now allocate the message reception buffer */
CHKmalloc(pThis->pMsg = (uchar *)malloc(pThis->iMaxLine + 1));
finalize_it:
@ -99,7 +97,6 @@ BEGINobjDestruct(tcps_sess) /* be sure to specify the object type also in END an
pThis->pSrv->pOnSessDestruct(&pThis->pUsr);
}
pthread_mutex_destroy(&pThis->mut);
DESTROY_ATOMIC_HELPER_MUT(pThis->mut_being_closed);
/* now destruct our own properties */
if (pThis->fromHost != NULL) CHKiRet(prop.Destruct(&pThis->fromHost));
if (pThis->fromHostIP != NULL) CHKiRet(prop.Destruct(&pThis->fromHostIP));

View File

@ -24,7 +24,6 @@
#include "obj.h"
#include "prop.h"
#include "atomic.h"
/* a forward-definition, we are somewhat cyclic */
struct tcpsrv_s;
@ -49,8 +48,6 @@ struct tcps_sess_s {
rsRetVal (*DoSubmitMessage)(tcps_sess_t *, uchar *, int); /* submit message callback */
int iMaxLine; /* fast lookup buffer for config property */
pthread_mutex_t mut;
int being_closed;
pthread_mutex_t mut_being_closed;
};

View File

@ -788,16 +788,13 @@ finalize_it:
* \retval RS_RET_ERR_* on errors during teardown; regardless, the session
* should be considered closed at the call site.
*/
static rsRetVal closeSess(tcpsrv_t *const pThis, tcpsrv_io_descr_t *const pioDescr) {
static ATTR_NONNULL() rsRetVal closeSess(tcpsrv_t *const pThis, tcpsrv_io_descr_t *const pioDescr) {
DEFiRet;
assert(pioDescr->ptrType == NSD_PTR_TYPE_SESS);
tcps_sess_t *pSess = pioDescr->ptr.pSess;
if (!ATOMIC_CAS(&pSess->being_closed, 0, 1, &pSess->mut_being_closed)) {
FINALIZE; /* already being closed by another thread */
}
#if defined(ENABLE_IMTCP_EPOLL)
/* note: we do not check the result of epoll_Ctl because we cannot do
* anything against a failure BUT we need to do the cleanup in any case.
*/
@ -810,13 +807,12 @@ static rsRetVal closeSess(tcpsrv_t *const pThis, tcpsrv_io_descr_t *const pioDes
tcps_sess.Destruct(&pSess);
#if defined(ENABLE_IMTCP_EPOLL)
/* in epoll mode, ioDescr is dynamically allocated */
/* in epoll mode, pioDescr is dynamically allocated */
DESTROY_ATOMIC_HELPER_MUT(pioDescr->mut_isInError);
free(pioDescr);
#else
pThis->pSessions[pioDescr->id] = NULL;
#endif
finalize_it:
RETiRet;
}