Commit Graph

53 Commits

Author SHA1 Message Date
itytophile
1e3560014f
Prevent deadlock when server is stopping (#426) 2023-02-25 14:41:05 -08:00
Benjamin Sergeant
84aa652846
Set shorter thread names (#379) 2022-04-30 10:16:53 -07:00
flagarde
74bb85efe9
Add getters (#327)
* Add getters for IXSocketServer class

* Add getters for IXHttpServer class

* Add getters for IXWebSocketServer class
2021-11-24 08:28:25 -08:00
Enzo
3f1fc6906c
Correctly convert remote port bytecode to uint16 port number. (#321)
* Correctly convert remote port bytecode to uint16 port number.

Copied the network_to_host_short function from the ASIO library to convert the remote port byte code to a uint16 number.

* Switched from uint16_t to unsigned short to work in Windows

* Updated missed uint16_t to unsigned short
2021-10-22 10:23:43 -07:00
Benjamin Sergeant
5c9c05caff bump version 2021-03-23 21:52:49 -07:00
Benjamin Sergeant
24c2eae3d7 use inet_ntop and inet_pton musl implementations on all platforms 2021-03-23 20:53:19 -07:00
Benjamin Sergeant
73b9c0b89b (socket servers) merge the ConnectionInfo class with the ConnectionState one, which simplify all the server apis 2020-08-28 14:55:40 -07:00
Benjamin Sergeant
2aaf59651e (socket server) in the loop accepting connections, call select without a timeout on unix to avoid busy looping, and only wake up when a new connection happens 2020-08-15 18:32:59 -07:00
Benjamin Sergeant
cd4e51eacf (socket server) instead of busy looping with a sleep, only wake up the GC thread when a new thread will have to be joined, (we know that thanks to the ConnectionState OnSetTerminated callback 2020-08-15 16:24:35 -07:00
Benjamin Sergeant
785842de03 (socket server) add a callback to the ConnectionState to be invoked when the connection is terminated. This will be used by the SocketServer in the future to know on time that the associated connection thread can be terminated. 2020-08-15 16:03:40 -07:00
Benjamin Sergeant
261095fa12 (socket server) do not create a select interrupt object everytime when polling for notifications while waiting for new connections, instead use a persistent one which is a member variable 2020-08-15 15:28:15 -07:00
Benjamin Sergeant
2798886c0b (websocket server) add a new simpler API to handle client connections / that API does not trigger a memory leak while the previous one did 2020-07-23 19:29:41 -07:00
Benjamin Sergeant
87709c201e (socket server) bump default max connection count from 32 to 128 2020-07-10 17:11:11 -07:00
Benjamin Sergeant
b21306376b uwp build fix + more ivp6 support 2020-07-08 12:38:55 -07:00
Benjamin Sergeant
fbd17685a1 (socket+websocket+http+redis+snake servers) expose the remote ip and remote port when a new connection is made (see #222) / only ipv4 is handled 2020-07-08 12:10:35 -07:00
Benjamin Sergeant
61e789d6a4 formatting 2020-03-24 20:37:55 -07:00
Benjamin Sergeant
179e17895d unique_ptr for sockets 2020-03-24 12:48:55 -07:00
Benjamin Sergeant
9f818c7acf (socket) selectInterrupt member is an unique_ptr instead of being a shared_ptr 2020-03-24 10:00:41 -07:00
Benjamin Sergeant
4a9b0b9dfd (server) give thread name to some usual worker threads / unittest is broken !! 2020-02-23 09:44:58 -08:00
Benjamin Sergeant
4c66a7561e (WebSocketServer) add option to disable deflate compression, exposed with the -x option to ws echo_server 2020-02-18 21:38:28 -08:00
Benjamin Sergeant
ed2a81f115 Fix #148 2020-01-27 17:29:44 -08:00
Seth Alves
7ed8ac208a bind returns zero on success (#149) 2020-01-27 17:15:44 -08:00
Benjamin Sergeant
aa12098cb5 add -6 option to ws echo_server / cf #148 2020-01-26 16:44:44 -08:00
Benjamin Sergeant
5d4bb90703 (SocketServer) add ability to bind on an ipv6 address 2020-01-26 16:21:56 -08:00
Benjamin Sergeant
d60777b9cc clang-format 2019-12-30 08:46:18 -08:00
Benjamin Sergeant
9dfcd8ea69 (ws client) all commands use spdlog instead of std::cerr or std::cout for logging 2019-12-24 21:55:34 -08:00
Benjamin Sergeant
a0cfaff528 Implement SSL server with OpenSSL backend / still flaky 2019-10-01 15:43:37 -07:00
Benjamin Sergeant
d6542383ed Add --tls option to pass to ws server command, to enable/disable tls 2019-10-01 13:54:46 -07:00
Benjamin Sergeant
afed387bcf Socket Factory has only one function which works for server and client code, and can do tls for both 2019-09-30 22:06:46 -07:00
Benjamin Sergeant
313949f087 SocketServer::handleConnection takes an std::shared_ptr<Socket> instead of a file descriptor 2019-09-30 21:48:55 -07:00
Benjamin Sergeant
845bbc5208 all ws subcommands propagate tls options to servers (unimplemented) or ws or http client (implemented) (contributed by Matt DeBoer) 2019-09-30 18:21:20 -07:00
Benjamin Sergeant
ceb0c602c9 Add simple Redis Server which is only capable of doing publish / subscribe. New ws redis_server sub-command to use it. The server is used in the unittest, so that we can run on CI in environment where redis isn not available like github actions env. 2019-09-23 21:04:01 -07:00
Benjamin Sergeant
cd3c9d879c reformat everything with clang-format 2019-09-23 10:25:23 -07:00
Benjamin Sergeant
e646e53dac use poll instead of select in SocketServer 2019-06-25 17:18:24 -07:00
Benjamin Sergeant
f84bc53c8d Feature/httpd (#94)
* Stub code for http server

* can send a response, cannot process body yet

* write headers to the response

* remove commented code

* add simple test + set default http handler

* tweak CI + unittest

* add missing file

* rewrite http::trim in a simple way

* doc
2019-06-23 14:54:21 -07:00
Benjamin Sergeant
841cfe37dd server code / add dedicated thread to close/join terminated connection threads 2019-05-13 17:17:35 -07:00
Benjamin Sergeant
3893c12054 socket server / used wrong mutex to protect _connectionsThreads 2019-05-06 12:24:20 -07:00
Dimon4eg
8ad47a315b Fix windows (#51)
* More fixes for Windows

* fix tests for windows

* qf for linux

* clean up
2019-05-06 12:22:57 -07:00
Dimon4eg
4d83dab4f3 Fix for windows (#50) 2019-05-06 09:13:42 -07:00
Benjamin Sergeant
a443bbdf80 Fix data races in DNSLookup (tsan) 2019-04-24 21:53:31 -07:00
Benjamin Sergeant
26ee46b246 better server termination / another try at preventing thread join failures 2019-04-24 09:45:53 -07:00
Benjamin Sergeant
323684efff (server) attempt to fix broken macOS unittest on travis CI 2019-04-22 09:36:16 -07:00
Benjamin Sergeant
662f66e501 (socket server) wait for all connections threads to be terminated before exiting stop method 2019-04-19 16:31:33 -07:00
Benjamin Sergeant
f4f60d38b8 docker + linux build fix 2019-04-17 22:52:03 -07:00
Benjamin Sergeant
52f460f66d (doc) Add more doc to SocketServer 2019-04-17 20:36:26 -07:00
Benjamin Sergeant
d486c72e02 websocket server: closed connection threads are joined properly 2019-04-17 20:36:26 -07:00
Benjamin Sergeant
bdfc55b951 Bug/30 server connection problem (#31)
* use threads instead of std::async, need to cleanup threads

* less buggy server connection per thread system
2019-04-16 22:19:44 -07:00
Benjamin Sergeant
eac611ab1e Feature/connection state (#25)
* (cmake) add a warning about 32/64 conversion problems.

* fix typo

* New connection state for server code + fix OpenSSL double init bug

* update README
2019-03-20 18:34:24 -07:00
Benjamin Sergeant
932bb732e0 Feature/send large message (#14)
* introduce send fragment

* can pass a fin frame

* can send messages which are a perfect multiple of the chunk size

* set fin only for last fragment

* cleanup

* last fragment should be of type CONTINUATION

* Add simple send and receive programs

* speedups receiving + better way to wait for thing

* receive speedup by using linked list of chunks instead of large array

* document bug

* use chunks to receive data

* trailing spaces
2019-02-20 18:59:07 -08:00
Benjamin Sergeant
726e66ca66 unittest for sending large messages 2019-02-16 10:32:02 -08:00