shove70 / buffer Goto Github PK
View Code? Open in Web Editor NEWprotocol buffer & rpc
License: MIT License
protocol buffer & rpc
License: MIT License
hi, just dub run in rpc_server and rpc_client and got:
dub run
Performing "debug" build using /usr/bin/dmd for x86_64.
crypto 0.2.2: target for configuration "library" is up to date.
buffer 0.2.16: target for configuration "library" is up to date.
rpc_client ~master: building configuration "application"...
Compiling script: message LoginInfo { string name; string password; ...
Linking...
To force a rebuild of up-to-date targets, run again with --force.
Running ./rpc_client
object.Exception@/home/playpeng/.dub/packages/crypto-0.2.2/crypto/src/crypto/padding.d(44): Invalid data size, which must be a multiple of blockSize.
----------------
/usr/include/dlang/dmd/std/exception.d:515 pure @safe void std.exception.bailOut!(Exception).bailOut(immutable(char)[], ulong, scope const(char)[]) [0x55f529a60fd2]
/usr/include/dlang/dmd/std/exception.d:436 pure @safe bool std.exception.enforce!().enforce!(bool).enforce(bool, lazy const(char)[], immutable(char)[], ulong) [0x55f529a760c6]
/home/playpeng/.dub/packages/crypto-0.2.2/crypto/src/crypto/padding.d:44 pure ubyte[] crypto.padding.PaddingImpl!(0, 0).PaddingImpl.padding(const(ubyte[]), ulong) [0x55f529a946a6]
/home/playpeng/.dub/packages/crypto-0.2.2/crypto/src/crypto/padding.d:182 ubyte[] crypto.padding.Padding.padding(const(ubyte[]), ulong, crypto.padding.PaddingMode) [0x55f529a94462]
/home/playpeng/.dub/packages/crypto-0.2.2/crypto/src/crypto/tea.d:219 ubyte[] crypto.tea.Xtea.encrypt(const(ubyte[]), int[4], int, crypto.padding.PaddingMode) [0x55f529a9ab81]
/home/playpeng/.dub/packages/crypto-0.2.2/crypto/src/crypto/tea.d:214 ubyte[] crypto.tea.Xtea.encrypt(const(ubyte[]), const(char[]), int, crypto.padding.PaddingMode) [0x55f529a9ab4d]
../../libbuffer/src/buffer/packet.d:141 ubyte[] buffer.packet.Packet.build(ushort, buffer.packet.CryptType, immutable(char)[], std.typecons.Nullable!(crypto.rsa.RSAKeyInfo).Nullable, immutable(char)[], immutable(char)[], std.variant.VariantN!(32uL).VariantN[]) [0x55f529a72921]
../../libbuffer/src/buffer/message.d:67 ubyte[] buffer.message.Message.serialize_without_msginfo!(immutable(char)[], immutable(char)[]).serialize_without_msginfo(immutable(char)[], immutable(char)[], immutable(char)[]) [0x55f529a6b856]
../../libbuffer/src/buffer/rpc/client.d:28 app.LoginRetInfo buffer.rpc.client.Client.call!(app.LoginRetInfo, immutable(char)[], immutable(char)[]).call(immutable(char)[], immutable(char)[], immutable(char)[]) [0x55f529a6b4ea]
src/app.d:39 _Dmain [0x55f529a59cc2]
Program exited with code 1
it seems that your recent update for crypto result in this.
貌似您的crypto更新导致了这个问题 😄️
hi,
I think there's some design mistake with the Client code implementation.
if I have a such a message:
message WebReqRetInfo {
int32 status;
string info;
}
Yes, this is actually the Ret object prototype. not the Input one.
But when compiling this code
Client.call!WebReqRetInfo("webRequest", "recfg");
we got err:
.dub/packages/buffer-0.2.7/buffer/libbuffer/src/buffer/rpc/client.d(44,13): Error: static assert: "Incorrect number of parameters, WebReqRetInfo requires 2 parameters."
source/rpcClient.d(38,37): instantiated from here: call!(WebReqRetInfo, string)
/usr/bin/dmd failed with exit code 1
which says that I need to put 2 parameters for the "webRequest" call.
this is something I think that parameter limit the Return incorrectlly applied to the Input, there's nothing telling this in the message
prototype.
Thanks!
The current implementation is really awesome but using it is still verbose. Having to use TCP directly and bytes is feels too low level for everyday usage.
Would be much convenient when the details are abstracted into an event-based approach for handle connection and sending messages (if you're familiar with Socket.IO in JavaScript).
server.on("connection", &handlerConnection);
server.on("call", &handleCall)
server.bindTCP("127.0.0.1", 8080)
//or
serverSettings = new ServerSettings()
server settings.setCliet(new TCPClient())// or any other UDP, etc
Client could also be abstracted this way. Buffer is a very useful to me cus I'm into microservices
Compiling script: message LoginInfo { string name; string password; ... ../../.dub/packages/buffer-0.2.7/buffer/libbuffer/src/buffer/rpc/server.d-mixin-55(66,33): Error: incompatible types for (ret) is (null): long and typeof(null) source/app.d(80,46): Error: template instance
buffer.rpc.server.Server!(Business).Server.Handler!null error instantiating /usr/bin/dmd failed with exit code 1.
it seems that long type in the following code doesn't mixing.
long GetUserId(string name)
{
// Access the database, query the user's id by name, assuming the user's ID is 1
int userId = 1;
// ...
// Query OK.
return userId;
}
and my D compiler version is 2.083.0, ldc 1.20.0
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.