mirror of
https://gitee.com/acl-dev/acl.git
synced 2024-11-30 02:47:56 +08:00
there is one bug in master_udp when running in multi-threads daemon mode.
This commit is contained in:
parent
33966ab441
commit
f5c499cc1a
@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#include "master_base.hpp"
|
||||
#include "../stdlib/locker.hpp"
|
||||
|
||||
namespace acl {
|
||||
|
||||
@ -50,6 +51,7 @@ protected:
|
||||
|
||||
private:
|
||||
std::vector<socket_stream*> sstreams_;
|
||||
locker locker_;
|
||||
|
||||
void close_sstreams(void);
|
||||
|
||||
|
@ -179,6 +179,7 @@ void master_udp::thread_init(void *)
|
||||
if (__mu->daemon_mode_)
|
||||
{
|
||||
ACL_VSTREAM** streams = acl_udp_server_streams();
|
||||
__mu->locker_.lock();
|
||||
if (streams != NULL)
|
||||
{
|
||||
for (int i = 0; streams[i] != NULL; i++)
|
||||
@ -189,6 +190,7 @@ void master_udp::thread_init(void *)
|
||||
__mu->sstreams_.push_back(ss);
|
||||
}
|
||||
}
|
||||
__mu->locker_.unlock();
|
||||
}
|
||||
#endif
|
||||
__mu->thread_on_init();
|
||||
|
Loading…
Reference in New Issue
Block a user