Skip to content

Commit d8ae84c

Browse files
committed
Thrift frame size adjustment
1 parent 08ff5d8 commit d8ae84c

3 files changed

Lines changed: 22 additions & 3 deletions

File tree

src/proxyfmu/client/proxy_slave.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ proxy_slave::proxy_slave(const filesystem::path& fmuPath, const std::string& ins
6363
host = remote->host();
6464
std::shared_ptr<TTransport> socket(new TSocket(host, remote->port()));
6565
auto transport = std::make_shared<TFramedTransport>(socket);
66+
transport->setMaxFrameSize(50 * 1024 * 1024);
6667
std::shared_ptr<TProtocol> protocol(new TBinaryProtocol(transport));
6768
auto client = std::make_shared<BootServiceClient>(protocol);
6869

tool/proxyfmu.cpp

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,23 @@ class ServerReadyEventHandler : public TServerEventHandler
4242
}
4343
};
4444

45+
46+
class ProxyFMUFramedTransportFactory : public TTransportFactory
47+
{
48+
public:
49+
explicit ProxyFMUFramedTransportFactory(uint32_t maxFrameSize)
50+
: maxFrameSize_(maxFrameSize)
51+
{ }
52+
53+
std::shared_ptr<TTransport> getTransport(std::shared_ptr<TTransport> trans) override
54+
{
55+
return std::shared_ptr<TTransport>(new TFramedTransport(trans, maxFrameSize_));
56+
}
57+
58+
private:
59+
uint32_t maxFrameSize_;
60+
};
61+
4562
const int port_range_min = 49152;
4663
const int port_range_max = 65535;
4764

@@ -50,6 +67,7 @@ const int max_port_retries = 10;
5067
const int SUCCESS = 0;
5168
const int COMMANDLINE_ERROR = 1;
5269
const int UNHANDLED_ERROR = 2;
70+
const int MAX_FRAME_SIZE = 50 * 1024 * 1024;
5371

5472

5573
void wait_for_input()
@@ -68,7 +86,7 @@ int run_booter_application(const int port)
6886
std::shared_ptr<boot_service_handler> handler(new boot_service_handler());
6987
std::shared_ptr<TProcessor> processor(new BootServiceProcessor(handler));
7088

71-
std::shared_ptr<TTransportFactory> transportFactory(new TFramedTransportFactory());
89+
std::shared_ptr<TTransportFactory> transportFactory(new ProxyFMUFramedTransportFactory(MAX_FRAME_SIZE));
7290
std::shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());
7391

7492
std::shared_ptr<TServerTransport> serverTransport(new TServerSocket(port));
@@ -93,7 +111,7 @@ int run_application(const std::string& fmu, const std::string& instanceName)
93111
std::shared_ptr<fmu_service_handler> handler(new fmu_service_handler(fmu, instanceName, stop));
94112
std::shared_ptr<TProcessor> processor(new FmuServiceProcessor(handler));
95113

96-
std::shared_ptr<TTransportFactory> transportFactory(new TFramedTransportFactory());
114+
std::shared_ptr<TTransportFactory> transportFactory(new ProxyFMUFramedTransportFactory(MAX_FRAME_SIZE));
97115
std::shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());
98116

99117
proxyfmu::fixed_range_random_generator rng(port_range_min, port_range_max);

version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.4.0
1+
0.4.1

0 commit comments

Comments
 (0)