Git Product home page Git Product logo

buffer's People

Contributors

shove70 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

buffer's Issues

running example client and server got: Invalid data size, which must be a multiple of blockSize

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更新导致了这个问题 😄️

design mistake: client call param count limit is incorrect.

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!

Abstraction socket TCP messaging

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

server example does not compile

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!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.