[haiku-commits] Re: haiku: hrev51344 - src/apps/networkstatus

  • From: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 03 Aug 2017 13:30:21 +0000

On Fri, 4 Aug 2017, 12:48 AM <philippe.houdoin@xxxxxxxxx> wrote:

hrev51344 adds 1 changeset to branch 'master'
old head: 65abebfaa73cc5833b38358e5d281a8f05914018
new head: cb7833c724482020aee37ec624db0f8705c5eff4
overview:
http://cgit.haiku-os.org/haiku/log/?qt=range&q=cb7833c72448+%5E65abebfaa73c


----------------------------------------------------------------------------

cb7833c72448: networkstatus: add no NoLink and LinkNoConfig status
  An interface that fail to configure due to link lost will be
  reported to have "No Link" instead of to be still "Configuring...",
  which was not the actual state.

                           [ Philippe Houdoin <philippe.houdoin@xxxxxxxxx>
]


----------------------------------------------------------------------------

Revision:    hrev51344
Commit:      cb7833c724482020aee37ec624db0f8705c5eff4
URL:         http://cgit.haiku-os.org/haiku/commit/?id=cb7833c72448
Author:      Philippe Houdoin <philippe.houdoin@xxxxxxxxx>
Date:        Thu Aug  3 14:40:48 2017 UTC


----------------------------------------------------------------------------

1 file changed, 8 insertions(+), 7 deletions(-)
src/apps/networkstatus/NetworkStatusView.cpp | 15 ++++++++-------


----------------------------------------------------------------------------

diff --git a/src/apps/networkstatus/NetworkStatusView.cpp
b/src/apps/networkstatus/NetworkStatusView.cpp
index 2495f3b..1062bc8 100644
--- a/src/apps/networkstatus/NetworkStatusView.cpp
+++ b/src/apps/networkstatus/NetworkStatusView.cpp
@@ -498,16 +498,17 @@ NetworkStatusView::_DetermineInterfaceStatus(
        const BNetworkInterface& interface)
 {
        uint32 flags = interface.Flags();
-       int32 status = kStatusNoLink;
-
-       // TODO: no kStatusLinkNoConfig yet

+       if ((flags & IFF_LINK) == 0)
+               return kStatusNoLink;
+       if ((flags & (IFF_UP | IFF_LINK | IFF_CONFIGURING)) == IFF_LINK)
+               return kStatusLinkNoConfig;
        if (flags & IFF_CONFIGURING)


You should have fixed this to be a boolean expression too.

-               status = kStatusConnecting;
-       else if ((flags & (IFF_UP | IFF_LINK)) == (IFF_UP | IFF_LINK))
-               status = kStatusReady;
+               return kStatusConnecting;
+       if ((flags & (IFF_UP | IFF_LINK)) == (IFF_UP | IFF_LINK))
+               return kStatusReady;

-       return status;
+       return kStatusUnknown;
 }

Other related posts: