mirror of
https://github.com/lxsang/antd-tunnel-publishers
synced 2024-12-26 01:48:21 +01:00
disable header check
This commit is contained in:
parent
a8979c48dc
commit
831eacf889
BIN
dist/antd-publishers-0.1.0a.tar.gz
vendored
BIN
dist/antd-publishers-0.1.0a.tar.gz
vendored
Binary file not shown.
8
tunnel.c
8
tunnel.c
@ -101,11 +101,13 @@ int open_unix_socket(char* path)
|
||||
|
||||
int msg_read(int fd, tunnel_msg_t* msg)
|
||||
{
|
||||
#ifdef VERIFY_HEADER
|
||||
if(msg_check_number(fd, MSG_MAGIC_BEGIN) == -1)
|
||||
{
|
||||
M_ERROR(MODULE_NAME, "Unable to check begin magic number");
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
if(read(fd,&msg->header.type,sizeof(msg->header.type)) == -1)
|
||||
{
|
||||
M_ERROR(MODULE_NAME, "Unable to read msg type: %s", strerror(errno));
|
||||
@ -131,6 +133,7 @@ int msg_read(int fd, tunnel_msg_t* msg)
|
||||
M_ERROR(MODULE_NAME, "Unable to read msg payload data");
|
||||
return -1;
|
||||
}
|
||||
#ifdef VERIFY_HEADER
|
||||
if(msg_check_number(fd, MSG_MAGIC_END) == -1)
|
||||
{
|
||||
if(msg->data)
|
||||
@ -140,11 +143,13 @@ int msg_read(int fd, tunnel_msg_t* msg)
|
||||
M_ERROR(MODULE_NAME, "Unable to check end magic number");
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
int msg_write(int fd, tunnel_msg_t* msg)
|
||||
{
|
||||
#ifdef VERIFY_HEADER
|
||||
// write begin magic number
|
||||
int number = MSG_MAGIC_BEGIN;
|
||||
if(write(fd,&number, sizeof(number)) == -1)
|
||||
@ -152,6 +157,7 @@ int msg_write(int fd, tunnel_msg_t* msg)
|
||||
M_ERROR(MODULE_NAME, "Unable to write begin magic number: %s", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
// write type
|
||||
if(write(fd,&msg->header.type, sizeof(msg->header.type)) == -1)
|
||||
{
|
||||
@ -186,11 +192,13 @@ int msg_write(int fd, tunnel_msg_t* msg)
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
#ifdef VERIFY_HEADER
|
||||
number = MSG_MAGIC_END;
|
||||
if(write(fd,&number, sizeof(number)) == -1)
|
||||
{
|
||||
M_ERROR(MODULE_NAME, "Unable to write end magic number: %s", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user