From f246b08a3757f5ea90dd66b874284c19ed2721a3 Mon Sep 17 00:00:00 2001 From: Michael Blizek Date: Sat, 7 Mar 2015 15:07:16 +0100 Subject: [PATCH] crd_execfailed response --- libcor.c | 49 ++++++------------------------------------------- test_connect2.c | 8 ++++++++ 2 files changed, 14 insertions(+), 43 deletions(-) diff --git a/libcor.c b/libcor.c index 47c33ab..bd67c6d 100644 --- a/libcor.c +++ b/libcor.c @@ -40,15 +40,10 @@ #define CDR_EXECOK 1 #define CDR_EXECFAILED 2 - #define CDR_EXECFAILED_UNKNOWN_COMMAND 1 - #define CDR_EXECFAILED_PERMISSION_DENIED 2 - #define CDR_EXECFAILED_TEMPORARILY_OUT_OF_RESSOURCES 3 - #define CDR_EXECFAILED_CMD_TOO_SHORT 4 - #define CDR_EXECFAILED_CMD_TOO_LONG 5 - #define CDR_EXECFAILED_TARGETADDR_DOESNTEXIST 6 - #define CDR_EXECFAILED_PORTCLOSED 7 - #define CDR_EXECFAILED_LISTENERQUEUE_FULL 8 - #define CDR_EXECFAILED_ILLEGAL_COMMAND 9 + #define CDR_EXECFAILED_INVALID_COMMAND 1 + #define CDR_EXECFAILED_TEMPORARILY_OUT_OF_RESSOURCES 2 + #define CDR_EXECFAILED_NB_DOESNTEXIST 3 + #define CDR_EXECFAILED_PORTCLOSED 4 #define CDR_BINDATA 3 @@ -516,10 +511,6 @@ int read_resp_nonblock(int fd, struct libcor_nonblock_resumeinfo *nr) if (state == 1) { goto state_1; - } else if (state == 2) { - goto state_2; - } else if (state == 3) { - goto state_3; } else if (unlikely(state != 0)) { LIBCOR_ASSERT_ERR(); } @@ -532,6 +523,8 @@ int read_resp_nonblock(int fd, struct libcor_nonblock_resumeinfo *nr) return bzero_nr_iffinished(nr, rc); if (nr_resp->respcode == CDR_EXECFAILED) { + /* printf("crd_execfailed\n"); */ + nr_resp->reasoncode = 0; nr_resp->state = 1; @@ -544,36 +537,6 @@ state_1: printf("execfailed: reasoncode = %d\n", (__s32) nr_resp->reasoncode); - - nr_resp->state = 2; -state_2: - rc = read_len(fd, nr, &(nr_resp->reasonlen), - 0); - if (rc != RC_OK) - return bzero_nr_iffinished(nr, rc); - - nr_resp->state = 3; -state_3: - rc = read_discard(fd, nr, nr_resp->reasonlen); - if (rc != RC_OK) - return bzero_nr_iffinished(nr, rc); - - /* - while (reasonlen > 0) { - __u32 nextread = reasonlen; - - if (reasonlen > 4093) - nextread = 4093; - reasonlen -= nextread; - int rc = read_fully(fd, buf, nextread, 0); - - if (rc) - return rc; - - buf[nextread] = 0; - printf("%s", buf); - } - printf("\n");*/ } //printf("read_resp: respcode = %d\n", nr_resp->respcode); diff --git a/test_connect2.c b/test_connect2.c index 4802371..9d2792d 100644 --- a/test_connect2.c +++ b/test_connect2.c @@ -56,6 +56,14 @@ int main(void) goto out; } + rc = shutdown(fd, SHUT_RDWR); + printf("shutdown\n"); + if(rc < 0) { + perror("shutdown"); + goto out; + } + + sleep(10); out: close(fd); -- 2.11.4.GIT