shill: LinkMonitor: Apply readability-review comments

Modify LinkMonitor and those affected by it to add
changes suggested during readability review.

BUG=chromium-os:32600
TEST=Unit tests

Change-Id: Ie48ac6d6ea1727207042fe5bf1519875b0673501
Reviewed-on: https://gerrit.chromium.org/gerrit/33047
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
diff --git a/link_monitor.h b/link_monitor.h
index 6182670..074e5a3 100644
--- a/link_monitor.h
+++ b/link_monitor.h
@@ -35,17 +35,17 @@
   // When the sum of consecutive unicast and broadcast failures
   // equals this value, the failure callback is called, the counters
   // are reset, and the link monitoring quiesces.  Needed by Metrics.
-  static const unsigned int kFailureThreshold;
+  static const int kFailureThreshold;
 
   // The number of milliseconds between ARP requests.  Needed by Metrics.
-  static const unsigned int kTestPeriodMilliseconds;
+  static const int kTestPeriodMilliseconds;
 
   // The default list of technologies for which link monitoring is enabled.
   static const char kDefaultLinkMonitorTechnologies[];
 
   LinkMonitor(const ConnectionRefPtr &connection,
-              EventDispatcher *dispatcher,
-              Metrics *metrics,
+              EventDispatcher *dispatcher,  // Owned by caller; can't be NULL.
+              Metrics *metrics,  // Owned by caller; must not be NULL.
               DeviceInfo *device_info,
               const FailureCallback &failure_callback);
   virtual ~LinkMonitor();
@@ -59,7 +59,7 @@
   // time.  Returns zero if no samples are available.  For each
   // missed ARP response, the sample is assumed to be the full
   // test period.
-  virtual unsigned int GetResponseTimeMilliseconds() const;
+  virtual int GetResponseTimeMilliseconds() const;
 
   // Returns true if the LinkMonitor was ever able to find the default
   // gateway via broadcast ARP.
@@ -72,10 +72,10 @@
   // The number of samples to compute a "strict" average over.  When
   // more samples than this number arrive, this determines how "slow"
   // our simple low-pass filter works.
-  static const unsigned int kMaxResponseSampleFilterDepth;
+  static const int kMaxResponseSampleFilterDepth;
 
   // Add a response time sample to the buffer.
-  void AddResponseTimeSample(unsigned int response_time_milliseconds);
+  void AddResponseTimeSample(int response_time_milliseconds);
   // Create an ArpClient instance so we can receive and transmit ARP
   // packets.  This method is virtual so it can be overridden in
   // unit tests.
@@ -91,24 +91,30 @@
   // Send the next ARP request.  Returns true if successful, false
   // otherwise.
   bool SendRequest();
-  // Timer callback which calls SendRequest().
-  void SendRequestTask();
 
+  // The connection on which to perform link monitoring.
   ConnectionRefPtr connection_;
+  // Dispatcher on which to create delayed tasks.
   EventDispatcher *dispatcher_;
+  // Metrics instance on which to post performance results.
   Metrics *metrics_;
+  // DeviceInfo instance for retrieving the MAC address of a device.
   DeviceInfo *device_info_;
+  // Failure callback method to call if LinkMonitor fails.
   FailureCallback failure_callback_;
+  // The MAC address of device associated with this connection.
   ByteString local_mac_address_;
+  // The MAC address of the default gateway.
   ByteString gateway_mac_address_;
+  // ArpClient instance used for performing link tests.
   scoped_ptr<ArpClient> arp_client_;
 
   // The number of consecutive times we have failed in receiving
   // responses to broadcast ARP requests.
-  unsigned int broadcast_failure_count_;
+  int broadcast_failure_count_;
   // The number of consecutive times we have failed in receiving
   // responses to unicast ARP requests.
-  unsigned int unicast_failure_count_;
+  int unicast_failure_count_;
 
   // Whether this iteration of the test was a unicast request
   // to the gateway instead of broadcast.  The link monitor
@@ -116,10 +122,13 @@
   // both types of network traffic is monitored.
   bool is_unicast_;
 
-  // Maintain a pseudo-average of response time.
-  unsigned int response_sample_count_;
-  unsigned int response_sample_bucket_;
+  // Number of response samples received in our rolling averge.
+  int response_sample_count_;
+  // The sum of response samples in our rolling average.
+  int response_sample_bucket_;
 
+  // IOCallback that fires when the socket associated with our ArpClient
+  // has a packet to be received.  Calls ReceiveResponse().
   scoped_ptr<IOHandler> receive_response_handler_;
   // Callback method used for periodic transmission of ARP requests.
   // When the timer expires this will call SendRequest() through the
@@ -131,6 +140,7 @@
 
   // The time at which the last ARP request was sent.
   struct timeval sent_request_at_;
+  // Time instance for performing GetTimeMonotonic().
   Time *time_;
 
   DISALLOW_COPY_AND_ASSIGN(LinkMonitor);