Module: kamailio
Branch: master
Commit: 2015cfdfd777085dad98a606fc41946af186db1b
URL:
https://github.com/kamailio/kamailio/commit/2015cfdfd777085dad98a606fc41946…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2021-02-10T17:10:25+01:00
ctl: fail when requested to process rpc commands in shutdown phase
---
Modified: src/modules/ctl/binrpc_run.c
Modified: src/modules/ctl/io_listener.c
---
Diff:
https://github.com/kamailio/kamailio/commit/2015cfdfd777085dad98a606fc41946…
Patch:
https://github.com/kamailio/kamailio/commit/2015cfdfd777085dad98a606fc41946…
---
diff --git a/src/modules/ctl/binrpc_run.c b/src/modules/ctl/binrpc_run.c
index 6323370b95..1ce9800553 100644
--- a/src/modules/ctl/binrpc_run.c
+++ b/src/modules/ctl/binrpc_run.c
@@ -630,11 +630,13 @@ int process_rpc_req(unsigned char* buf, int size, int*
bytes_needed,
if(ksr_shutdown_phase()) {
/* during shutdown - no more RPC command handling */
- return 0;
+ LM_DBG("shutdown phase - skipping rpc command\n");
+ return -1;
}
if (size<BINRPC_MIN_PKT_SIZE){
*bytes_needed=BINRPC_MIN_PKT_SIZE-size;
+ LM_DBG("more data needed - at least: %d bytes\n", *bytes_needed);
return 0; /* more data, nothing processed */
}
err=init_binrpc_ctx(&f_ctx, buf, size, sh);
diff --git a/src/modules/ctl/io_listener.c b/src/modules/ctl/io_listener.c
index e8182ac629..93ce89c948 100644
--- a/src/modules/ctl/io_listener.c
+++ b/src/modules/ctl/io_listener.c
@@ -495,6 +495,7 @@ static int handle_stream_read(struct stream_connection* s_c, int idx)
DBG("handle_stream read: eof on %s\n", s_c->parent->name);
goto close_connection;
}
+ LM_INFO("bytes read: %d\n", bytes_read);
r->end+=bytes_read;
if (bytes_read && (bytes_read<r->bytes_to_go)){
r->bytes_to_go-=bytes_read;
@@ -514,6 +515,7 @@ static int handle_stream_read(struct stream_connection* s_c, int idx)
/* error while processing the packet => close the connection */
goto close_connection;
}
+ LM_INFO("bytes processed: %d\n", bytes_processed);
r->proc+=bytes_processed;
r->bytes_to_go=bytes_needed;
if (bytes_needed>0){