From 7b1a570d54ac4c82325aeeee70d7a8871ecd688a Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Mon, 23 Jun 2008 10:29:15 +0200 Subject: changed Rcv-Interface in tcpsrv subsystem It is now iRet based. This enables us to communicate more in-depth information to the upper peers. This is needed to handle the EGAIN case on rcv (not yet implemented) --- runtime/nsd_gtls.c | 12 +++++++++--- runtime/nsd_gtls.h | 3 ++- runtime/rsyslog.h | 3 +++ 3 files changed, 14 insertions(+), 4 deletions(-) (limited to 'runtime') diff --git a/runtime/nsd_gtls.c b/runtime/nsd_gtls.c index fad84689..75887913 100644 --- a/runtime/nsd_gtls.c +++ b/runtime/nsd_gtls.c @@ -1388,9 +1388,15 @@ Rcv(nsd_t *pNsd, uchar *pBuf, ssize_t *pLenBuf) /* in TLS mode now */ lenRcvd = gnutls_record_recv(pThis->sess, pBuf, *pLenBuf); if(lenRcvd < 0) { - int gnuRet; /* TODO: build a specific function for GnuTLS error reporting */ - *pLenBuf = -1; - CHKgnutls(lenRcvd); /* this will abort the function */ + if(lenRcvd == GNUTLS_E_AGAIN || lenRcvd == GNUTLS_E_INTERRUPTED) { + pThis->rtryCall = gtlsRtry_recv; + dbgprintf("GnuTLS receive requires a retry (this most probably is OK and no error condition)\n"); + iRet = RS_RET_RETRY; + } else { + int gnuRet; /* TODO: build a specific function for GnuTLS error reporting */ + *pLenBuf = -1; + CHKgnutls(lenRcvd); /* this will abort the function */ + } } *pLenBuf = lenRcvd; diff --git a/runtime/nsd_gtls.h b/runtime/nsd_gtls.h index bbd650a2..d6821dce 100644 --- a/runtime/nsd_gtls.h +++ b/runtime/nsd_gtls.h @@ -28,7 +28,8 @@ typedef enum { gtlsRtry_None = 0, /**< no call needs to be retried */ - gtlsRtry_handshake = 1 + gtlsRtry_handshake = 1, + gtlsRtry_recv = 2 } gtlsRtryCall_t; /**< IDs of calls that needs to be retried */ typedef nsd_if_t nsd_gtls_if_t; /* we just *implement* this interface */ diff --git a/runtime/rsyslog.h b/runtime/rsyslog.h index f296a608..5364a87a 100644 --- a/runtime/rsyslog.h +++ b/runtime/rsyslog.h @@ -238,6 +238,9 @@ enum rsRetVal_ /** return value. All methods return this if not specified oth RS_RET_FILE_NO_STAT = -2096, /**< can not stat() a file */ RS_RET_FILE_TOO_LARGE = -2097, /**< a file is larger than permitted */ RS_RET_INVALID_WILDCARD = -2098, /**< a wildcard entry is invalid */ + RS_RET_CLOSED = -2099, /**< connection was closed */ + RS_RET_RETRY = -2100, /**< call should be retried (e.g. EGAIN on recv) */ + RS_RET_GSS_ERR = -2101, /**< generic error occured in GSSAPI subsystem */ /* RainerScript error messages (range 1000.. 1999) */ RS_RET_SYSVAR_NOT_FOUND = 1001, /**< system variable could not be found (maybe misspelled) */ -- cgit