linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #07082
[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 3316: don't run async calls when disconnecting
------------------------------------------------------------
revno: 3316
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Tue 2013-06-25 17:45:51 +0200
message:
don't run async calls when disconnecting
modified:
changelog.txt
dcpp/BufferedSocket.cpp
dcpp/BufferedSocket.h
--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk
Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'changelog.txt'
--- changelog.txt 2013-06-25 11:26:24 +0000
+++ changelog.txt 2013-06-25 15:45:51 +0000
@@ -1,5 +1,6 @@
* Translation fixes
* [L#1194299] Prevent races when sending INF/MyINFO (maksis, poy)
+* [L#1194299] Prevent races when closing a connection (maksis, poy)
-- 0.825 2013-06-18 --
* [L#1191099] Group partial file list uploads to avoid a crash (poy)
=== modified file 'dcpp/BufferedSocket.cpp'
--- dcpp/BufferedSocket.cpp 2013-04-14 22:01:23 +0000
+++ dcpp/BufferedSocket.cpp 2013-06-25 15:45:51 +0000
@@ -452,8 +452,9 @@
if(p.first == SHUTDOWN) {
return false;
+
} else if(p.first == ASYNC_CALL) {
- static_cast<CallData*>(p.second.get())->f();
+ if(!disconnecting) { static_cast<CallData*>(p.second.get())->f(); }
continue;
}
@@ -524,8 +525,9 @@
}
void BufferedSocket::shutdown() {
- Lock l(cs);
disconnecting = true;
+
+ Lock l(cs);
addTask(SHUTDOWN, 0);
}
=== modified file 'dcpp/BufferedSocket.h'
--- dcpp/BufferedSocket.h 2013-01-24 20:18:18 +0000
+++ dcpp/BufferedSocket.h 2013-06-25 15:45:51 +0000
@@ -165,7 +165,7 @@
std::unique_ptr<Socket> sock;
State state;
- bool disconnecting;
+ atomic<bool> disconnecting;
bool v4only;
virtual int run();