summaryrefslogtreecommitdiff
path: root/src/libwaitress
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2011-09-18 17:40:34 +0200
committerLars-Dominik Braun <lars@6xq.net>2011-11-09 20:10:03 +0100
commit87b4d04dc18a4e13db37ed07d8222992b52fab1a (patch)
treed3b9174d4671165c4eabe97e238bd7d20d7d355a /src/libwaitress
parentc73c89eabd2b1924e1bed851c980e6eb4498d31b (diff)
downloadpianobar-windows-87b4d04dc18a4e13db37ed07d8222992b52fab1a.tar.gz
pianobar-windows-87b4d04dc18a4e13db37ed07d8222992b52fab1a.tar.bz2
pianobar-windows-87b4d04dc18a4e13db37ed07d8222992b52fab1a.zip
waitress: added identity handler
Diffstat (limited to 'src/libwaitress')
-rw-r--r--src/libwaitress/waitress.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/libwaitress/waitress.c b/src/libwaitress/waitress.c
index 0c52f06..00b775b 100644
--- a/src/libwaitress/waitress.c
+++ b/src/libwaitress/waitress.c
@@ -507,6 +507,14 @@ static void WaitressHandleHeader (WaitressHandle_t *waith, const char * const ke
}
}
+/* identity encoding handler
+ */
+static WaitressCbReturn_t WaitressHandleIdentity (WaitressHandle_t *waith,
+ char *buf, size_t size) {
+ waith->contentReceived += size;
+ return waith->callback (buf, size, waith->data);
+}
+
/* Receive data from host and call *callback ()
* @param waitress handle
* @return WaitressReturn_t
@@ -705,8 +713,7 @@ WaitressReturn_t WaitressFetchCall (WaitressHandle_t *waith) {
/* push remaining bytes */
if (bufFilled > 0) {
- waith->contentReceived += bufFilled;
- if (waith->callback (thisLine, bufFilled, waith->data) ==
+ if (WaitressHandleIdentity (waith, thisLine, bufFilled) ==
WAITRESS_CB_RET_ERR) {
CLOSE_RET (WAITRESS_RET_CB_ABORT);
}
@@ -716,8 +723,7 @@ WaitressReturn_t WaitressFetchCall (WaitressHandle_t *waith) {
do {
READ_RET (recvBuf, sizeof (recvBuf), &recvSize);
if (recvSize > 0) {
- waith->contentReceived += recvSize;
- if (waith->callback (recvBuf, recvSize, waith->data) ==
+ if (WaitressHandleIdentity (waith, recvBuf, recvSize) ==
WAITRESS_CB_RET_ERR) {
wRet = WAITRESS_RET_CB_ABORT;
break;