mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
Merge pull request #2003 from alexanderkjeldaas/documented-locking-part-2
Documented locking part 1+2
This commit is contained in:
22
src/net.h
22
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();
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user