diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2017-04-05 02:32:06 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2017-04-23 02:03:47 +0200 |
commit | b57308e4a134fb6139d2cb52a031d3e7185f16cf (patch) | |
tree | 7c31d445e2f76bb737ef90ce29e0e7e6738d6eb1 /fnet/src/examples/ping | |
parent | 40b8ba5a3f34028d208d4e0dc1b46940d6fe5a47 (diff) |
Use override
Diffstat (limited to 'fnet/src/examples/ping')
-rw-r--r-- | fnet/src/examples/ping/packets.h | 22 | ||||
-rw-r--r-- | fnet/src/examples/ping/pingclient.cpp | 8 | ||||
-rw-r--r-- | fnet/src/examples/ping/pingserver.cpp | 18 |
3 files changed, 21 insertions, 27 deletions
diff --git a/fnet/src/examples/ping/packets.h b/fnet/src/examples/ping/packets.h index 68cc27ccb5b..27a06bdaab3 100644 --- a/fnet/src/examples/ping/packets.h +++ b/fnet/src/examples/ping/packets.h @@ -1,36 +1,36 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once +#include <vespa/fnet/packet.h> +#include <vespa/fnet/ipacketfactory.h> enum { PCODE_PING_REQUEST = 1, PCODE_PING_REPLY = 2 }; - class PingRequest : public FNET_Packet { public: - virtual uint32_t GetPCODE() override; - virtual uint32_t GetLength() override; - virtual void Encode(FNET_DataBuffer *) override; - virtual bool Decode(FNET_DataBuffer *src, uint32_t len) override; + uint32_t GetPCODE() override; + uint32_t GetLength() override; + void Encode(FNET_DataBuffer *) override; + bool Decode(FNET_DataBuffer *src, uint32_t len) override; }; - class PingReply : public FNET_Packet { public: - virtual uint32_t GetPCODE() override; - virtual uint32_t GetLength() override; - virtual void Encode(FNET_DataBuffer *) override; - virtual bool Decode(FNET_DataBuffer *src, uint32_t len) override; + uint32_t GetPCODE() override; + uint32_t GetLength() override; + void Encode(FNET_DataBuffer *) override; + bool Decode(FNET_DataBuffer *src, uint32_t len) override; }; class PingPacketFactory : public FNET_IPacketFactory { public: - virtual FNET_Packet *CreatePacket(uint32_t pcode, FNET_Context) override; + FNET_Packet *CreatePacket(uint32_t pcode, FNET_Context) override; }; diff --git a/fnet/src/examples/ping/pingclient.cpp b/fnet/src/examples/ping/pingclient.cpp index fb834b9108b..0b28f118685 100644 --- a/fnet/src/examples/ping/pingclient.cpp +++ b/fnet/src/examples/ping/pingclient.cpp @@ -1,15 +1,13 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("pingclient"); + #include <vespa/fnet/fnet.h> #include <examples/ping/packets.h> - +#include <vespa/fastos/app.h> class PingClient : public FastOS_Application { public: - int Main() override; + int Main() override; }; diff --git a/fnet/src/examples/ping/pingserver.cpp b/fnet/src/examples/ping/pingserver.cpp index 173e627ac23..3c76bc951ec 100644 --- a/fnet/src/examples/ping/pingserver.cpp +++ b/fnet/src/examples/ping/pingserver.cpp @@ -1,10 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP("pingserver"); + #include <vespa/fnet/fnet.h> #include <examples/ping/packets.h> - +#include <vespa/fastos/app.h> class PingServer : public FNET_IServerAdapter, public FNET_IPacketHandler, @@ -12,15 +10,13 @@ class PingServer : public FNET_IServerAdapter, { public: bool InitAdminChannel(FNET_Channel *) override { return false; } - bool InitChannel(FNET_Channel *channel, uint32_t) override - { + bool InitChannel(FNET_Channel *channel, uint32_t) override { channel->SetContext(FNET_Context(channel)); channel->SetHandler(this); return true; } - - HP_RetCode HandlePacket(FNET_Packet *packet, FNET_Context context) override - { + + HP_RetCode HandlePacket(FNET_Packet *packet, FNET_Context context) override { if (packet->GetPCODE() == PCODE_PING_REQUEST) { fprintf(stderr, "Got ping request, sending ping reply\n"); context._value.CHANNEL->Send(new PingReply()); @@ -28,8 +24,8 @@ public: packet->Free(); return FNET_FREE_CHANNEL; } - - int Main() override; + + int Main() override; }; |