aboutsummaryrefslogtreecommitdiffstats
path: root/fnet/src/examples
diff options
context:
space:
mode:
authorArne H Juul <arnej27959@users.noreply.github.com>2017-04-24 12:10:42 +0200
committerGitHub <noreply@github.com>2017-04-24 12:10:42 +0200
commit9ff4bdb407ed8d855a3f86a17c99906ff738177b (patch)
treefc2b050224d7dde92d57e1f9cac12c1e5aaf6b90 /fnet/src/examples
parent32ae190acc9ac5081049e1c7008d1602c68cf821 (diff)
Revert "Balder/enforce override 2"
Diffstat (limited to 'fnet/src/examples')
-rw-r--r--fnet/src/examples/frt/rpc/echo_client.cpp7
-rw-r--r--fnet/src/examples/frt/rpc/rpc_callback_client.cpp8
-rw-r--r--fnet/src/examples/frt/rpc/rpc_callback_server.cpp8
-rw-r--r--fnet/src/examples/frt/rpc/rpc_client.cpp8
-rw-r--r--fnet/src/examples/frt/rpc/rpc_info.cpp7
-rw-r--r--fnet/src/examples/frt/rpc/rpc_invoke.cpp7
-rw-r--r--fnet/src/examples/frt/rpc/rpc_proxy.cpp10
-rw-r--r--fnet/src/examples/frt/rpc/rpc_server.cpp8
-rw-r--r--fnet/src/examples/ping/packets.h22
-rw-r--r--fnet/src/examples/ping/pingclient.cpp8
-rw-r--r--fnet/src/examples/ping/pingserver.cpp18
-rw-r--r--fnet/src/examples/proxy/proxy.cpp29
-rw-r--r--fnet/src/examples/timeout/timeout.cpp8
13 files changed, 84 insertions, 64 deletions
diff --git a/fnet/src/examples/frt/rpc/echo_client.cpp b/fnet/src/examples/frt/rpc/echo_client.cpp
index 9a5cf7cbd64..b5fabb32363 100644
--- a/fnet/src/examples/frt/rpc/echo_client.cpp
+++ b/fnet/src/examples/frt/rpc/echo_client.cpp
@@ -1,12 +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("echo_client");
#include <vespa/fnet/frt/frt.h>
-#include <vespa/fastos/app.h>
class EchoClient : public FastOS_Application
{
public:
- int Main() override;
+ virtual int Main() override;
};
int
diff --git a/fnet/src/examples/frt/rpc/rpc_callback_client.cpp b/fnet/src/examples/frt/rpc/rpc_callback_client.cpp
index 2bf740f7b1e..3dd936f7fea 100644
--- a/fnet/src/examples/frt/rpc/rpc_callback_client.cpp
+++ b/fnet/src/examples/frt/rpc/rpc_callback_client.cpp
@@ -1,7 +1,9 @@
// 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("rpc_callback_client");
#include <vespa/fnet/frt/frt.h>
-#include <vespa/fastos/app.h>
+
struct RPC : public FRT_Invokable
{
@@ -32,7 +34,7 @@ RPC::Init(FRT_Supervisor *s)
class MyApp : public FastOS_Application
{
public:
- int Main() override;
+ virtual int Main() override;
};
int
diff --git a/fnet/src/examples/frt/rpc/rpc_callback_server.cpp b/fnet/src/examples/frt/rpc/rpc_callback_server.cpp
index 67eac0743d6..419b1266d23 100644
--- a/fnet/src/examples/frt/rpc/rpc_callback_server.cpp
+++ b/fnet/src/examples/frt/rpc/rpc_callback_server.cpp
@@ -1,7 +1,9 @@
// 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("rpc_callback_server");
#include <vespa/fnet/frt/frt.h>
-#include <vespa/fastos/app.h>
+
struct RPC : public FRT_Invokable
{
@@ -38,7 +40,7 @@ RPC::Init(FRT_Supervisor *s)
class MyApp : public FastOS_Application
{
public:
- int Main() override;
+ virtual int Main() override;
};
int
diff --git a/fnet/src/examples/frt/rpc/rpc_client.cpp b/fnet/src/examples/frt/rpc/rpc_client.cpp
index 435bfb6f08c..f5e5a9fe1e2 100644
--- a/fnet/src/examples/frt/rpc/rpc_client.cpp
+++ b/fnet/src/examples/frt/rpc/rpc_client.cpp
@@ -1,12 +1,14 @@
// 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("rpc_client");
#include <vespa/fnet/frt/frt.h>
-#include <vespa/fastos/app.h>
+
class RPCClient : public FastOS_Application
{
public:
- int Main() override;
+ virtual int Main() override;
};
int
diff --git a/fnet/src/examples/frt/rpc/rpc_info.cpp b/fnet/src/examples/frt/rpc/rpc_info.cpp
index ae9eafa210d..5b7aebd6bdd 100644
--- a/fnet/src/examples/frt/rpc/rpc_info.cpp
+++ b/fnet/src/examples/frt/rpc/rpc_info.cpp
@@ -1,7 +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("rpc_info");
#include <vespa/fnet/frt/frt.h>
-#include <vespa/fastos/app.h>
class RPCInfo : public FastOS_Application
{
@@ -63,7 +64,7 @@ public:
printf("\n");
}
- int Main() override;
+ virtual int Main() override;
};
diff --git a/fnet/src/examples/frt/rpc/rpc_invoke.cpp b/fnet/src/examples/frt/rpc/rpc_invoke.cpp
index 1bb572a6025..0f64ef9b539 100644
--- a/fnet/src/examples/frt/rpc/rpc_invoke.cpp
+++ b/fnet/src/examples/frt/rpc/rpc_invoke.cpp
@@ -1,7 +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("rpc_invoke");
#include <vespa/fnet/frt/frt.h>
-#include <vespa/fastos/app.h>
class RPCClient : public FastOS_Application
{
@@ -42,7 +43,7 @@ private:
int run();
public:
- int Main() override;
+ virtual int Main() override;
};
int
diff --git a/fnet/src/examples/frt/rpc/rpc_proxy.cpp b/fnet/src/examples/frt/rpc/rpc_proxy.cpp
index e73f556b9d8..6c805d6a173 100644
--- a/fnet/src/examples/frt/rpc/rpc_proxy.cpp
+++ b/fnet/src/examples/frt/rpc/rpc_proxy.cpp
@@ -1,7 +1,9 @@
// 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("rpc_proxy");
#include <vespa/fnet/frt/frt.h>
-#include <vespa/fastos/app.h>
+
//-----------------------------------------------------------------------------
struct Session
@@ -66,7 +68,7 @@ private:
public:
ReqDone(RPCProxy &proxy) : _proxy(proxy) {}
- void RequestDone(FRT_RPCRequest *req) override;
+ virtual void RequestDone(FRT_RPCRequest *req) override;
};
void
@@ -207,7 +209,7 @@ RPCProxy::HOOK_Fini(FRT_RPCRequest *req)
class App : public FastOS_Application
{
public:
- int Main() override;
+ virtual int Main() override;
};
int
diff --git a/fnet/src/examples/frt/rpc/rpc_server.cpp b/fnet/src/examples/frt/rpc/rpc_server.cpp
index 2b7e16b91b6..823d3c893b1 100644
--- a/fnet/src/examples/frt/rpc/rpc_server.cpp
+++ b/fnet/src/examples/frt/rpc/rpc_server.cpp
@@ -1,7 +1,9 @@
// 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("rpc_server");
#include <vespa/fnet/frt/frt.h>
-#include <vespa/fastos/app.h>
+
class RPCServer : public FRT_Invokable
{
@@ -105,7 +107,7 @@ private:
public:
App() : _server() {}
- int Main() override;
+ virtual int Main() override;
};
int
diff --git a/fnet/src/examples/ping/packets.h b/fnet/src/examples/ping/packets.h
index 27a06bdaab3..68cc27ccb5b 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:
- uint32_t GetPCODE() override;
- uint32_t GetLength() override;
- void Encode(FNET_DataBuffer *) override;
- bool Decode(FNET_DataBuffer *src, uint32_t len) override;
+ 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;
};
+
class PingReply : public FNET_Packet
{
public:
- uint32_t GetPCODE() override;
- uint32_t GetLength() override;
- void Encode(FNET_DataBuffer *) override;
- bool Decode(FNET_DataBuffer *src, uint32_t len) override;
+ 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;
};
class PingPacketFactory : public FNET_IPacketFactory
{
public:
- FNET_Packet *CreatePacket(uint32_t pcode, FNET_Context) override;
+ virtual 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 0b28f118685..fb834b9108b 100644
--- a/fnet/src/examples/ping/pingclient.cpp
+++ b/fnet/src/examples/ping/pingclient.cpp
@@ -1,13 +1,15 @@
// 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 3c76bc951ec..173e627ac23 100644
--- a/fnet/src/examples/ping/pingserver.cpp
+++ b/fnet/src/examples/ping/pingserver.cpp
@@ -1,8 +1,10 @@
// 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,
@@ -10,13 +12,15 @@ 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());
@@ -24,8 +28,8 @@ public:
packet->Free();
return FNET_FREE_CHANNEL;
}
-
- int Main() override;
+
+ int Main() override;
};
diff --git a/fnet/src/examples/proxy/proxy.cpp b/fnet/src/examples/proxy/proxy.cpp
index 2d1d44174a4..40d7a44c7f6 100644
--- a/fnet/src/examples/proxy/proxy.cpp
+++ b/fnet/src/examples/proxy/proxy.cpp
@@ -1,10 +1,9 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
-#include <vespa/fnet/fnet.h>
-#include <vespa/fastos/app.h>
-
+#include <vespa/fastos/fastos.h>
#include <vespa/log/log.h>
LOG_SETUP("proxy");
+#include <vespa/fnet/fnet.h>
+
class RawPacket : public FNET_Packet
{
@@ -13,10 +12,10 @@ private:
public:
RawPacket() : _data() {}
- uint32_t GetPCODE() override;
- uint32_t GetLength() override;
- void Encode(FNET_DataBuffer *) override;
- bool Decode(FNET_DataBuffer *src, uint32_t len) override;
+ 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
@@ -70,7 +69,7 @@ public:
_server = server;
}
- HP_RetCode HandlePacket(FNET_Packet *packet, FNET_Context context) override;
+ virtual HP_RetCode HandlePacket(FNET_Packet *packet, FNET_Context context) override;
};
@@ -140,14 +139,14 @@ private:
public:
Proxy() : _transport() {}
- bool GetPacketInfo(FNET_DataBuffer *src, uint32_t *plen, uint32_t *pcode, uint32_t *chid, bool *) override;
- FNET_Packet *Decode(FNET_DataBuffer *src, uint32_t plen, uint32_t pcode, FNET_Context) override;
- void Encode(FNET_Packet *packet, uint32_t chid, FNET_DataBuffer *dst) override;
+ virtual bool GetPacketInfo(FNET_DataBuffer *src, uint32_t *plen, uint32_t *pcode, uint32_t *chid, bool *) override;
+ virtual FNET_Packet *Decode(FNET_DataBuffer *src, uint32_t plen, uint32_t pcode, FNET_Context) override;
+ virtual void Encode(FNET_Packet *packet, uint32_t chid, FNET_DataBuffer *dst) override;
// ---------------------------------------------
- bool InitAdminChannel(FNET_Channel *channel) override;
- bool InitChannel(FNET_Channel *, uint32_t) override;
+ virtual bool InitAdminChannel(FNET_Channel *channel) override;
+ virtual bool InitChannel(FNET_Channel *, uint32_t) override;
// ---------------------------------------------
- int Main() override;
+ virtual int Main() override;
};
diff --git a/fnet/src/examples/timeout/timeout.cpp b/fnet/src/examples/timeout/timeout.cpp
index 7edfbe4fb1c..8a52d769282 100644
--- a/fnet/src/examples/timeout/timeout.cpp
+++ b/fnet/src/examples/timeout/timeout.cpp
@@ -1,7 +1,9 @@
// 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("timeout");
#include <vespa/fnet/fnet.h>
-#include <vespa/fastos/app.h>
+
class Timeout : public FNET_Task
{
@@ -18,7 +20,7 @@ public:
_queue(queue)
{}
- void PerformTask() override;
+ virtual void PerformTask() override;
};