Fixed signal handling of recv message
Revert to signal handling in 6.5 that was changed in the netconf uniform handling in 7.0
This commit is contained in:
parent
a2fe24937b
commit
ca786da156
3 changed files with 28 additions and 11 deletions
|
|
@ -47,6 +47,8 @@ Developers may need to change their code
|
|||
|
||||
### Corrected Busg
|
||||
|
||||
* Fixed: Signal handling of recv message
|
||||
Revert to signal handling in 6.5 that was changed in the netconf uniform handling in 7.0
|
||||
* Fixed: [NETCONF error reply from failed leafref rquire-instance does not comply to RFC 7950](https://github.com/clicon/clixon/issues/536)
|
||||
|
||||
## 7.1.0
|
||||
|
|
|
|||
|
|
@ -128,17 +128,32 @@ netconf_input_read2(int s,
|
|||
ssize_t buflen,
|
||||
int *eof)
|
||||
{
|
||||
int retval = -1;
|
||||
ssize_t len;
|
||||
int retval = -1;
|
||||
ssize_t len;
|
||||
int restarts = 0;
|
||||
int maxrestarts = 5;
|
||||
|
||||
memset(buf, 0, buflen);
|
||||
if ((len = read(s, buf, buflen)) < 0){
|
||||
if (errno == ECONNRESET)
|
||||
len = 0; /* emulate EOF */
|
||||
else{
|
||||
while ((len = read(s, buf, buflen)) < 0) {
|
||||
switch (errno){
|
||||
case EINTR:
|
||||
case EAGAIN:
|
||||
if (restarts++ >= maxrestarts){
|
||||
clixon_log(NULL, LOG_ERR, "%s: read: %s", __FUNCTION__, strerror(errno));
|
||||
goto done;
|
||||
}
|
||||
break; /* Try again */
|
||||
case ECONNRESET: /* Connection reset by peer */
|
||||
case EPIPE: /* Client shutdown */
|
||||
case EBADF: /* Client shutdown - freebsd */
|
||||
len = 0; /* Emulate EOF */
|
||||
break;
|
||||
default:
|
||||
clixon_log(NULL, LOG_ERR, "%s: read: %s", __FUNCTION__, strerror(errno));
|
||||
goto done;
|
||||
}
|
||||
if (len == 0)
|
||||
break;
|
||||
} /* read */
|
||||
clixon_debug(CLIXON_DBG_DEFAULT | CLIXON_DBG_DETAIL, "len:%ld", len);
|
||||
if (len == 0){ /* EOF */
|
||||
|
|
|
|||
|
|
@ -549,7 +549,7 @@ clixon_msg_rcv11(int s,
|
|||
size_t frame_size = 0;
|
||||
unsigned char *p = buf;
|
||||
size_t plen;
|
||||
cbuf *cbmsg=NULL;
|
||||
cbuf *cbmsg = NULL;
|
||||
ssize_t len;
|
||||
int eom = 0;
|
||||
cxobj *xtop = NULL;
|
||||
|
|
@ -557,10 +557,6 @@ clixon_msg_rcv11(int s,
|
|||
sigset_t oldsigset = {0,};
|
||||
struct sigaction oldsigaction[32] = {{{0,},},};
|
||||
|
||||
if ((cbmsg = cbuf_new()) == NULL){
|
||||
clixon_err(OE_XML, errno, "cbuf_new");
|
||||
goto done;
|
||||
}
|
||||
eom = 0;
|
||||
*eof = 0;
|
||||
if (intr){
|
||||
|
|
@ -573,6 +569,10 @@ clixon_msg_rcv11(int s,
|
|||
/* May be more signals to ignore */
|
||||
set_signal(SIGWINCH, SIG_IGN, NULL);
|
||||
}
|
||||
if ((cbmsg = cbuf_new()) == NULL){
|
||||
clixon_err(OE_XML, errno, "cbuf_new");
|
||||
goto done;
|
||||
}
|
||||
while (*eof == 0 && eom == 0) {
|
||||
/* Read input data from socket and append to cbbuf */
|
||||
if ((len = netconf_input_read2(s, buf, buflen, eof)) < 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue