Giter Club home page Giter Club logo

libkitsunemimisakuranetwork's Introduction

libKitsunemimiSakuraNetwork

IMPORTANT: This repository is no longer maintained, because in context of issue kitsudaiki/Hanami#31 the content was moved into the main-repository (https://github.com/kitsudaiki/Hanami-AI).

Github workfloat status GitHub tag (latest SemVer) GitHub C++Version Platform

Description

This library provides a simple session-layer-protocol, which I created for data-transfers in my projects.

It suppots sessions, which can base on Unix-Domain-Sockets, TCP or TLS encrypted TCP.

The following messages-types are supported:

  • stream-messages

    This are very simple and fast messages. For these messages, there is no additional memory allocation and the receiver of the messages gets only little parts. The data are only inside the message-ring-buffer of the socket, so the receiver have to process them instantly, or they will be overwritten. These messages are for cases, when the layer above should handle the data and wants as minimal overhead as possible.

  • request-response-messages:

    This are a special case of the standalone-messages. The request-call sends a standalone-message to the receiver with an ID and blocks the thread, which has called the request-method, until the other side sends a response-message with the ID back. The request-message returns after its release the received data. This way it can force a synchronized communication to implement for example RPC-calls.

Build

Requirements

name repository version task
g++ g++ >= 8.0 Compiler for the C++ code.
make make >= 4.0 process the make-file, which is created by qmake to build the programm with g++
qmake qt5-qmake >= 5.0 This package provides the tool qmake, which is similar to cmake and create the make-file for compilation.
ssl library libssl-dev >= 1.1 encryption for tls connections

Installation on Ubuntu/Debian:

sudo apt-get install g++ make qt5-qmake libssl-dev

IMPORTANT: All my projects are only tested on Linux.

Kitsunemimi-repositories

Repository-Name Version-Tag Download-Path
libKitsunemimiCommon develop https://github.com/kitsudaiki/libKitsunemimiCommon.git
libKitsunemimiNetwork develop https://github.com/kitsudaiki/libKitsunemimiNetwork.git

HINT: These Kitsunemimi-Libraries will be downloaded and build automatically with the build-script below.

build library

In all of my repositories you will find a build.sh. You only have to run this script. It doesn't required sudo, because you have to install required tool via apt, for example, by yourself. But if other projects from me are required, it download them from github and build them in the correct version too. This script is also use by the ci-pipeline, so its tested with every commit.

Run the following commands:

git clone https://github.com/kitsudaiki/libKitsunemimiSakuraNetwork.git
cd libKitsunemimiSakuraNetwork
./build.sh
cd ../result

It create automatic a build and result directory in the directory, where you have cloned the project. At first it build all into the build-directory and after all build-steps are finished, it copy the include directory from the cloned repository and the build library into the result-directory. So you have all in one single place.

Tested on Debian and Ubuntu. If you use Centos, Arch, etc and the build-script fails on your machine, then please write me a mail and I will try to fix the script.

Usage

(sorry, docu comes later)

Contributing

Please give me as many inputs as possible: Bugs, bad code style, bad documentation and so on.

License

This project is licensed under the Apache License Version 2.0 - see the LICENSE file for details

libkitsunemimisakuranetwork's People

Contributors

kitsudaiki avatar

Watchers

 avatar

libkitsunemimisakuranetwork's Issues

update message creation

Cleanup-request

Description

creating messages with a constructure is too slow and has to replace by an inline-method for all messages

rework callbacks

Cleanup-request

Description

Since I created a liking to make the central class in the repos as static singleton, its not necessary anymore to send the target-object over the callbacks. So this can be removed to reduce code-complexity. Beside this, the session-callback should be split.

add message forwarding

Feature-request

Description

It should be possible to sessions with each other to forward messages as fast as possible without any processing of the content

tag 0.4.0

Tag-request

Checklist

  • Changelog
  • Version-tag in pro-file
  • Version-tag of requirements in Readme
  • Version-tag of requirements in build-script
  • Add tag

possible race-condition in session-controller

The session-controller make some operations on the map of the session-handler. These operations are not linked to the spin-lock within the session-handler. Because of this, even the chance is very small, it is possible to create a race-condition.

add synchronous message creation

Feature-request

Description

Add synchronous message creation. The start-session-methods should be able to wait, until the session-creation was completed on client-side.

add message-queue

Feature-request

Description

While send/receive a multiblock message, its not possible to send another one. Additional messages should be queued in a queue with its own thread, to be send as soon as possible.

Related Issue

Kitsunemimi-Repos, which have to be updated

Possible Implementation

edge-case in message-size

If a message has a multiple of the maximum size of a single-message-content, in the multi-block case, the last packet is empty, which is empty.

add blocking messages

Feature-request

Description

Add a mechanism for messages to block the calling thread until an answer was rescinded or a timeout appeared.

tag 0.5.0

Tag-request

Checklist

  • Changelog
  • Version-tag in pro-file
  • Version-tag of requirements in Readme
  • Version-tag of requirements in build-script
  • Add tag

server-close broken

BUG-issue

What you wanted to do

Description of the bug you run into

When closing a server of any type, it also closes all its sockets, but not the server-related session itself. So the sessions are unusable after closing the server.

Possible Solution

closing a server should not result in closing the sockets, because this makes problems

Steps to Reproduce

  1. create a server
  2. create multiple sessions
  3. close server
  4. try to send messages over the sessions

Environment

Possible Implementation

split stream messages

Feature-request

Description

Messages, which should be send as stream-messsages, but are too big, should be automatically splitted and send as multiple packages.

tag 0.3.0

Tag-request

Checklist

  • Changelog
  • Version-tag in pro-file
  • Version-tag of requirements in Readme
  • Version-tag of requirements in build-script
  • Add tag

race-condition in `isIdUsed`

the method isIdUsed in the session-handler has a race-condition. IDs of sessions in the pending list, are ignored and even, if they are not ignored, there is a little time-window, where IDs are used, but in no list.

This race-condition must be avoided, to avoid double usage of IDs.

The current ignorance of the pending IDs is the reasion, why the test actually works. More correctly, only two differenc instances of the test-binary should be able to create a session.

crash on systems with only one cpu-thread

BUG-issue

Description

Tried to run the benchmark-test within a test-instance with only one cpu-threads resulted in some heart-beat timeouts and the following message:

benchmark_tests: ../../../libKitsunemimiProjectNetwork/src/callbacks.h:100: uint64_t Kitsunemimi::Project::processMessage(void*, Kitsunemimi::Network::MessageRingBuffer*): Assertion `found' failed.
Aborted (core dumped)

delimiter check is missing

BUG-issue

Description

The check for the delimiter at the end of each message is missing and still has to be implemented.

update callback-setter

Cleanup-request

Description

The callbacks for stream and standalone messages at the moment should be set in the controller. This makes problems, if different connections should trigger different callbacks. This have to be changed.

Deadlock when closing all session

BUG-issue

Description

When the method closeAllSession of the SessionController-class is called, the process runs into a dead-lock within the session-handler.

tag 0.2.0

Tag-request

Checklist

  • Changelog
  • Version-tag in pro-file
  • Version-tag of requirements in Readme
  • Version-tag of requirements in build-script
  • Add tag

add state machine

Add state with the state machine of libKitsuneCommon to each session.

use different IDs for both session-sides

Both sides of a session should be allowed to have different IDs and as replacement, both should store the id of the other side. This would result in the advantages:

  • no pending list anymore
  • solve the race-condition of #11
  • no id-change-messages necessary

error-callbacks after closing a session

BUG-issue

Description

Even after a session is stopped and closed, it is still possible, that there are remaining messages and heartbeats in the timeout-queue. These should be removed in case, that the session is closed to avoid unnecessary error-callbacks.

abort of multiblock messages broken

In the current state, only the sender of a multiblock-message can abort the send process, but for the receiver of the data this is not possible. Problem is, that the thread who sends the data is also the only one, who could receive and process an abort-message from the other side.

Possible solution: between each send packet of the multiblock message, it should be checked, if there are incoming messages on the socket and handle these, if some exist. This makes the send slow, but makes the process also more flexible.

dynamic size for all payload-messages

Feature-request

Description

Messages, which should transfer data to the other side, should always have a dynamic size of payload to use the bandwidth more efficiently.

add benchmark-test

Feature-request

Description

add a performance-test for a client-server connection

add custom value to session-init

there should be a value in the ini-message, which is send by the client to the server, so the server can identify a group for the new incoming session.

rework blocking messages

Feature-request

Description

The current concept of blocking message is not very nice to handle and need a rework.

false timeout-message

BUG-issue

Description

White testing with the cli-tester, I found out that there are message timeouts, which shouldn' appear.

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.