Browse Source

[1924] Less confusing parameter names for sendmsg

Changed to header and payload, which removes the confusion of the first
part message being called env and the other called msg in one send and
the first being msg (and the second omitted) in the second case.
Michal 'vorner' Vaner 12 years ago
parent
commit
3a07d07e04
3 changed files with 12 additions and 12 deletions
  1. 5 5
      src/lib/cc/session.cc
  2. 3 3
      src/lib/cc/session.h
  3. 4 4
      src/lib/cc/tests/session_unittests.cc

+ 5 - 5
src/lib/cc/session.cc

@@ -343,8 +343,8 @@ Session::establish(const char* socket_file) {
 // prefix.
 //
 void
-Session::sendmsg(ConstElementPtr msg) {
-    std::string header_wire = msg->toWire();
+Session::sendmsg(ConstElementPtr header) {
+    std::string header_wire = header->toWire();
     unsigned int length = 2 + header_wire.length();
     unsigned int length_net = htonl(length);
     unsigned short header_length = header_wire.length();
@@ -356,9 +356,9 @@ Session::sendmsg(ConstElementPtr msg) {
 }
 
 void
-Session::sendmsg(ConstElementPtr env, ConstElementPtr msg) {
-    std::string header_wire = env->toWire();
-    std::string body_wire = msg->toWire();
+Session::sendmsg(ConstElementPtr header, ConstElementPtr payload) {
+    std::string header_wire = header->toWire();
+    std::string body_wire = payload->toWire();
     unsigned int length = 2 + header_wire.length() + body_wire.length();
     unsigned int length_net = htonl(length);
     unsigned short header_length = header_wire.length();

+ 3 - 3
src/lib/cc/session.h

@@ -172,9 +172,9 @@ namespace isc {
             // replace them. It is not expected to be specialized by a derived
             // class. Actually, it is not expected to inherit from this class
             // to begin with.
-            virtual void sendmsg(isc::data::ConstElementPtr msg);
-            virtual void sendmsg(isc::data::ConstElementPtr env,
-                                 isc::data::ConstElementPtr msg);
+            virtual void sendmsg(isc::data::ConstElementPtr header);
+            virtual void sendmsg(isc::data::ConstElementPtr header,
+                                 isc::data::ConstElementPtr payload);
 
             bool recvmsg(isc::data::ConstElementPtr& msg,
                          bool nonblock = true,

+ 4 - 4
src/lib/cc/tests/session_unittests.cc

@@ -149,11 +149,11 @@ public:
 private:
     // Override the sendmsg. They are not sent over the real connection, but
     // stored locally and can be extracted by getSentMessage()
-    virtual void sendmsg(ConstElementPtr msg) {
-        sendmsg(msg, ConstElementPtr(new isc::data::NullElement));
+    virtual void sendmsg(ConstElementPtr header) {
+        sendmsg(header, ConstElementPtr(new isc::data::NullElement));
     }
-    virtual void sendmsg(ConstElementPtr env, ConstElementPtr msg) {
-        sent_messages_.push_back(SentMessage(env, msg));
+    virtual void sendmsg(ConstElementPtr header, ConstElementPtr payload) {
+        sent_messages_.push_back(SentMessage(header, payload));
     }
 
     // The sendmsg stores data here.