aboutsummaryrefslogtreecommitdiff
path: root/src/net.h
diff options
context:
space:
mode:
authorAlexander Kjeldaas <alexander.kjeldaas@gmail.com>2012-11-10 23:51:50 -0300
committerAlexander Kjeldaas <alexander.kjeldaas@gmail.com>2012-11-11 00:55:48 -0300
commit25511af4a57816c4f9bb960527f090a9719c9010 (patch)
tree7f712aada0275de141f38ae8579e179dd2db5088 /src/net.h
parent05f97d1263540b5f9faae971374a25ddc3f6dadb (diff)
o Annotated lock-like functions in net.h.
o Removed unused function EndMessageAbortIfEmpty
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 57c53035f9..07da6edebc 100644
--- a/src/net.h
+++ b/src/net.h
@@ -311,7 +311,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)
@@ -323,7 +324,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;
@@ -336,7 +338,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)
{
@@ -368,19 +371,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();