From 4fd62552d8277f3d0ed20e66663cd219c36796df Mon Sep 17 00:00:00 2001
From: wangzhengquan <wangzhengquan85@126.com>
Date: 星期四, 21 一月 2021 11:20:22 +0800
Subject: [PATCH] update
---
src/socket/shm_mod_socket.cpp | 24 +++++-------------------
1 files changed, 5 insertions(+), 19 deletions(-)
diff --git a/src/socket/shm_mod_socket.cpp b/src/socket/shm_mod_socket.cpp
index 8a9133d..4340bc4 100644
--- a/src/socket/shm_mod_socket.cpp
+++ b/src/socket/shm_mod_socket.cpp
@@ -9,7 +9,6 @@
}
ShmModSocket::ShmModSocket() {
- mod = (socket_mod_t)0;
shm_socket = shm_open_socket(SHM_SOCKET_DGRAM);
bus_set = new std::set<int>;
}
@@ -54,20 +53,7 @@
int ShmModSocket::sendto_nowait( const void *buf, const int size, const int key){
return shm_sendto(shm_socket, buf, size, key, NULL, (int)SHM_MSG_NOWAIT);
}
-
-
-inline int ShmModSocket::_recvfrom_(void **buf, int *size, int *key, struct timespec *timeout, int flags) {
-
- if(mod == BUS) {
- logger->error("Can not use method recvfrom in a Bus");
- exit(1);
- }
-// printf("dgram_mod_recvfrom before\n");
- int rv = shm_recvfrom(shm_socket, buf, size, key, timeout, flags);
-// printf("dgram_mod_recvfrom after\n");
-
- return rv;
-}
+
/**
* 鎺ユ敹淇℃伅
@@ -75,20 +61,20 @@
* @return 0 鎴愬姛锛� 鍏朵粬鍊� 澶辫触鐨勯敊璇爜
*/
int ShmModSocket::recvfrom(void **buf, int *size, int *key) {
- int rv = _recvfrom_( buf, size, key, NULL, 0);
- // logger->error(rv, "ShmModSocket::recvfrom failed!");
+ int rv = shm_recvfrom(shm_socket, buf, size, key, NULL, 0);
+
return rv;
}
// 鎺ュ彈淇℃伅瓒呮椂杩斿洖銆� @sec 绉� 锛� @nsec 绾崇
int ShmModSocket::recvfrom_timeout( void **buf, int *size, int *key, struct timespec *timeout) {
- int rv = _recvfrom_(buf, size, key, timeout, 0);
+ int rv = shm_recvfrom(shm_socket, buf, size, key, timeout, 0);
return rv;
}
int ShmModSocket::recvfrom_nowait( void **buf, int *size, int *key){
- int rv = _recvfrom_(buf, size, key, NULL, (int)SHM_MSG_NOWAIT);
+ int rv = shm_recvfrom(shm_socket, buf, size, key, NULL, (int)SHM_MSG_NOWAIT);
// logger->error(rv, "ShmModSocket::recvfrom_nowait failed!");
return rv;
}
--
Gitblit v1.8.0