lichao
2021-03-31 6eefba812ede29549af3633c490f2e85a4805524
src/socket.cpp
@@ -17,16 +17,17 @@
 */
#include "socket.h"
#include <chrono>
#include "msg.h"
#include "defs.h"
#include "bh_util.h"
#include "defs.h"
#include "msg.h"
#include <chrono>
using namespace bhome_msg;
using namespace bhome_shm;
using namespace std::chrono_literals;
namespace {
namespace
{
int GetSocketDefaultLen(ShmSocket::Type type) 
{
@@ -39,13 +40,10 @@
    }
}
} // namespace
}
ShmSocket::ShmSocket(Type type, bhome_shm::SharedMemory &shm)
    : shm_(shm),
      type_(type),
      run_(false)
ShmSocket::ShmSocket(Type type, bhome_shm::SharedMemory &shm) :
    shm_(shm), type_(type), run_(false)
{
    int len = GetSocketDefaultLen(type);
    if (len != 0) {
@@ -61,15 +59,17 @@
                            this->onRecv_(msg);
                        }
                    }
                } catch (...) {}
            } catch (...) {
            }
            }
        };
        run_.store(true);
        workers_.emplace_back(RecvProc);
    }
}
ShmSocket::ShmSocket(Type type)
    : ShmSocket(type, BHomeShm())
ShmSocket::ShmSocket(Type type) :
    ShmSocket(type, BHomeShm())
{
}