-
Notifications
You must be signed in to change notification settings - Fork 5
/
README
35 lines (29 loc) · 1.07 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
socket<->socket relay that listens on UDP or TCP port and enqueues
packets into one or more workers which send them to their destination.
If the remote socket is TCP then the relay uses TCP_CORK (if available).
install:
$ git clone https://github.com/demerphq/relay.git
$ cd relay
$ make
$ ./bin/event-relay --help
packet \ / worker -> listener-1
packet |- relay - worker -> listener-2
packet / \ worker -> listener-3
main_thread
-> foreach listener
-> start one worker thread
-> listen for udp sereal packet
-> append sereal packet to queue for each worker
worker
main_loop:
-> if queue is non-empty
-> lock queue
hijack queue (move items from queue to local storage)
unlock queue
-> open connection to listener
-> while items in hijacked queue
-> try to send top item to listener
-> if it fails: write remaining items to disk
goto main_loop
-> if it is ok: pop item from hijacked queue.
-> close connection