Skip to content

Commit 59cd9b4

Browse files
committed
Fix for SEGV in ADThreadNetClient
1 parent 7c80bbe commit 59cd9b4

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

include/chimbuko/ad/ADNetClient.hpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,12 +167,18 @@ namespace chimbuko{
167167
bool complete;
168168

169169
ClientActionBlockingSendReceive(Message *recv, Message const *send): send(send), recv(recv), complete(false){}
170+
// ClientActionBlockingSendReceive(Message *recv, const Message &send): send(send), recv(recv), complete(false){}
170171

171172
void perform(ADNetClient &client){
172173
//std::cout << "Performing blocking send and receive" << std::endl;
173174
client.send_and_receive(*recv, *send);
174-
complete = true;
175-
cv.notify_one();
175+
// client.send_and_receive(*recv, send);
176+
177+
{
178+
std::unique_lock<std::mutex> lk(m);
179+
complete = true;
180+
cv.notify_one();
181+
}
176182
}
177183
bool do_delete() const{ return false; }
178184

@@ -236,7 +242,7 @@ namespace chimbuko{
236242
while(nwork > 0){
237243
ClientAction* work_item = getWorkItem();
238244
work_item->perform(client);
239-
shutdown = work_item->shutdown_worker();
245+
shutdown = shutdown || work_item->shutdown_worker();
240246

241247
if(work_item->do_delete()) delete work_item;
242248
nwork = getNwork();
@@ -273,6 +279,7 @@ namespace chimbuko{
273279
}
274280
void send_and_receive(Message &recv, const Message &send){
275281
ClientActionBlockingSendReceive action(&recv, &send);
282+
// ClientActionBlockingSendReceive action(&recv, send);
276283
enqueue_action(&action);
277284
action.wait_for();
278285
}

0 commit comments

Comments
 (0)