Commit 60a9150a authored by Claes Sjofors's avatar Claes Sjofors

Modbus TCP server, signalhandler added for SIGPIPE

parent 1a88ea50
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
#include <unistd.h> #include <unistd.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <pthread.h> #include <pthread.h>
#include <signal.h>
#include "pwr.h" #include "pwr.h"
#include "co_cdh.h" #include "co_cdh.h"
...@@ -77,6 +78,10 @@ typedef struct { ...@@ -77,6 +78,10 @@ typedef struct {
int idx; int idx;
} mb_sCondata; } mb_sCondata;
static void signal_callback_handler(int signum){
printf("Caught signal SIGPIPE %d\n",signum);
}
static void mb_close_connection( io_sRack *rp, int l_idx) static void mb_close_connection( io_sRack *rp, int l_idx)
{ {
pwr_sClass_Modbus_TCP_Server *op = (pwr_sClass_Modbus_TCP_Server *) rp->op; pwr_sClass_Modbus_TCP_Server *op = (pwr_sClass_Modbus_TCP_Server *) rp->op;
...@@ -788,6 +793,9 @@ static pwr_tStatus IoRackInit ( ...@@ -788,6 +793,9 @@ static pwr_tStatus IoRackInit (
int i; int i;
unsigned short port; unsigned short port;
// Ignore SIGPIPE signal
signal( SIGPIPE, signal_callback_handler);
op = (pwr_sClass_Modbus_TCP_Server *) rp->op; op = (pwr_sClass_Modbus_TCP_Server *) rp->op;
op->Connections = 0; op->Connections = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment