aboutsummaryrefslogtreecommitdiff
path: root/src/net.h
diff options
context:
space:
mode:
authorGavin Andresen <gavinandresen@gmail.com>2012-12-12 09:27:35 -0800
committerGavin Andresen <gavinandresen@gmail.com>2012-12-12 09:27:35 -0800
commit8a7277a578463a647664b068b6b7b69cf09cda57 (patch)
treec9476bd8d25c92ed83d97bf91c0dfe4fe1cfa738 /src/net.h
parent50894e4fd47efe207bff3db9978b7a22979822c7 (diff)
parent25511af4a57816c4f9bb960527f090a9719c9010 (diff)
downloadbitcoin-8a7277a578463a647664b068b6b7b69cf09cda57.tar.xz
Merge pull request #2003 from alexanderkjeldaas/documented-locking-part-2
Documented locking part 1+2
Diffstat (limited to 'src/net.h')
-rw-r--r--src/net.h22
1 files changed, 6 insertions, 16 deletions
diff --git a/src/net.h b/src/net.h
index c43e438d5a..ace119f954 100644
--- a/src/net.h
+++ b/src/net.h
@@ -305,7 +305,8 @@ public:
- void BeginMessage(const char* pszCommand)
+ // TODO: Document the postcondition of this function. Is cs_vSend locked?
+ void BeginMessage(const char* pszCommand) EXCLUSIVE_LOCK_FUNCTION(cs_vSend)
{
ENTER_CRITICAL_SECTION(cs_vSend);
if (nHeaderStart != -1)
@@ -317,7 +318,8 @@ public:
printf("sending: %s ", pszCommand);
}
- void AbortMessage()
+ // TODO: Document the precondition of this function. Is cs_vSend locked?
+ void AbortMessage() UNLOCK_FUNCTION(cs_vSend)
{
if (nHeaderStart < 0)
return;
@@ -330,7 +332,8 @@ public:
printf("(aborted)\n");
}
- void EndMessage()
+ // TODO: Document the precondition of this function. Is cs_vSend locked?
+ void EndMessage() UNLOCK_FUNCTION(cs_vSend)
{
if (mapArgs.count("-dropmessagestest") && GetRand(atoi(mapArgs["-dropmessagestest"])) == 0)
{
@@ -362,19 +365,6 @@ public:
LEAVE_CRITICAL_SECTION(cs_vSend);
}
- void EndMessageAbortIfEmpty()
- {
- if (nHeaderStart < 0)
- return;
- int nSize = vSend.size() - nMessageStart;
- if (nSize > 0)
- EndMessage();
- else
- AbortMessage();
- }
-
-
-
void PushVersion();