Commit Graph

49 Commits

Author SHA1 Message Date
Benjamin Sergeant
2e379cbf2a do not select on a closed file descriptor (doing so crash on Android) 2019-05-22 18:58:22 -07:00
Benjamin Sergeant
701be31554 Revert "Revert "fix cast warning caught on windows""
This reverts commit 25eaf730bc.
2019-05-13 22:16:49 -07:00
Benjamin Sergeant
25eaf730bc Revert "fix cast warning caught on windows"
This reverts commit 4edb7447df.
2019-05-13 21:35:34 -07:00
Benjamin Sergeant
4edb7447df fix cast warning caught on windows 2019-05-13 21:29:47 -07:00
Dimon4eg
9aacebbbaf fix for Windows (#69)
* fix for Windows

* fix condition

* make condition only on Windows
2019-05-12 22:21:56 -07:00
Benjamin Sergeant
c7f0bf3d64 use spdlog for logging in ws + unittest + remove un-needed mutex 2019-05-09 15:30:44 -07:00
Kumamon38
cb1d1bfd85 fix ping, fix send frame close (#49)
* fix ping, fix send frame close

* fixes for data race on _closeCode etc. and fix test

* fixing one TC

* fix waiting forever if no time to change of readyState, and poll never end

* add 1005 code if no status code received

* fixes for 1005 code

* fix test issue

* fix macOS issue

* revert to master tests and renaming
2019-05-09 09:21:05 -07:00
Dimon4eg
fa7f0fadde Remove redundant iostream includes (#60) 2019-05-08 13:33:21 -07:00
Dimon4eg
78198a0147 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
753fc845ac Fix for windows (#50) 2019-05-06 09:13:42 -07:00
Benjamin Sergeant
b0139c2217 add locks around Socket::send and Socket::recv to see if it helps with thread sanitizer error in Linux CI 2019-04-19 14:28:51 -07:00
Benjamin Sergeant
91106b7456 Socket::Poll does not need a callback 2019-04-19 09:32:49 -07:00
Dimon4eg
fbb7c012a3 fix windows build (#29)
* fix windows build

* fix for Unix

* Fix build if TLS is OFF

* add OpenSSL req to ws

* Fix build on Mac

* fix tests for windows
2019-04-16 08:51:57 -07:00
Benjamin Sergeant
e77b9176f3
Feature/redis (#23)
* Fix warning

* (cmake) add a warning about 32/64 conversion problems.

* simple redis clients

* can publish to redis

* redis subscribe

* display messages received per second

* verbose flag

* (cmake) use clang only compile option -Wshorten-64-to-32 when compiling with clang
2019-03-20 14:29:02 -07:00
Benjamin Sergeant
310724c961 make PollResultType an enum class 2019-03-19 09:29:57 -07:00
Benjamin Sergeant
ceba8ae620 fix bug with isReadyToWrite 2019-03-18 22:05:04 -07:00
Benjamin Sergeant
9c8c17f577 use milliseconds 2019-03-18 20:17:44 -07:00
Benjamin Sergeant
d5d1a2c5f4 no default parameters for isReadyToWrite and isReadyToRead 2019-03-18 14:31:21 -07:00
Benjamin Sergeant
2a90e3f478 when trying to flush the send buffer, use select to wait until it is possible instead of using sleep to retry at a given frequency 2019-03-18 14:25:27 -07:00
Benjamin Sergeant
4f2babaf54 select interrupt cleanup 2019-03-14 18:37:38 -07:00
Benjamin Sergeant
977b995af9 replace uint8_t with uint64_t for the send/close requests types / use named variable to index into the _fildes array 2019-03-14 15:03:57 -07:00
Benjamin Sergeant
2750df8aa7
send can fail silently when sending would block (EWOULDBLOCK return for send) (#18)
* try to use a pipe for communication

* flush send buffer on the background thread

* cleanup

* linux fix / linux still use event fd for now

* cleanup
2019-03-13 23:09:45 -07:00
Benjamin Sergeant
9c3b0b08ec Socket code refactoring, plus stop polling with a 1s timeout in readBytes while we only want to poll with a 1ms timeout 2019-03-04 13:40:15 -08:00
Benjamin Sergeant
fe7d94194c readBytes does not read bytes one by one but in chunks 2019-03-02 21:11:16 -08:00
Benjamin Sergeant
d6c26d6aa8 create a blocking + cancellable Socket::readBytes method 2019-03-02 15:16:46 -08:00
Benjamin Sergeant
8a74ddcd13 create a blocking + cancellable Socket::readBytes method 2019-03-02 11:01:51 -08:00
Benjamin Sergeant
3a77e96a05
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
ee12fbdb5f windows build fix 2019-01-27 10:46:02 -08:00
Benjamin Sergeant
316c630830 constexpr to declare number of fds 2019-01-26 21:01:36 -08:00
Benjamin Sergeant
1ea5db6110 linux fix 2019-01-26 20:57:48 -08:00
Benjamin Sergeant
986d9a00c0 remove shutdown call 2019-01-26 20:54:23 -08:00
Benjamin Sergeant
7a05a11014 rebase poll branch 2019-01-26 20:50:25 -08:00
Benjamin Sergeant
05033714bf hearbeat 2019-01-24 12:42:49 -08:00
Benjamin Sergeant
1fa75d7fb2 check select errors better 2019-01-07 11:18:00 -08:00
Benjamin Sergeant
cc8a9e883e unittest + compiler warnings 2019-01-05 21:10:08 -08:00
Benjamin Sergeant
50f4fd1115 int -> ssize_t for socker recv and send 2019-01-05 20:53:50 -08:00
Benjamin Sergeant
06d2b68696 header refactoring 2019-01-05 20:38:43 -08:00
Benjamin Sergeant
46d00360a8 unittest on appveyor 2019-01-04 17:28:13 -08:00
Benjamin Sergeant
af3df5e519 Socket::readLine works with arbitrary long lines 2019-01-03 18:47:01 -08:00
Benjamin Sergeant
d75753ec98 timeout is configurable 2019-01-03 18:33:08 -08:00
Benjamin Sergeant
cb904416c3 server unittest for validating client request / new timeout cancellation handling (need refactoring) 2019-01-02 16:08:32 -08:00
Benjamin Sergeant
239b5bc02c refactoring + cancellation was buggy during http upgrade 2019-01-02 07:45:07 -08:00
Benjamin Sergeant
24c9e0abc3 can create a socket from a fd 2018-12-29 21:53:33 -08:00
Benjamin Sergeant
b34eccd749 non blocking dns lookup 2018-12-14 16:28:17 -08:00
Benjamin Sergeant
50b638f7fd add cancellation support while connecting, to speed up WebSocket::stop 2018-12-09 17:56:20 -08:00
Benjamin Sergeant
5bf1b91528 http upgrade and connections use non blocking sockets 2018-12-09 14:07:40 -08:00
Benjamin Sergeant
c1ed83a005 stopping connection on Linux does not close the socket, which can create problem when re-starting the connection 2018-11-01 17:02:49 -07:00
Benjamin Sergeant
16805759d3 Windows support (no TLS yet) 2018-10-08 21:44:54 -07:00
Benjamin Sergeant
9b8d6cedfe First import 2018-09-27 14:57:19 -07:00