Commit Graph
6 Commits
Author SHA1 Message Date
9seconds 16f9ec690b Fix race condition in closing a relay
This commit fixes a situration when relay can be reset before all
waiting goroutines are finished. For example, we terminate processing
based on some event: socket error etc. So, error happens and context is
cancelled. After that a main relay goroutine starts to wait. Meanwhile a
second goroutine reaches deferred function and set wg to done. It means
that main goroutine can continue.

In this case this is really possible that we can start resetting before
transmit goroutine really exits.

A correct solution is to always do wg.Done() as a first deferred thing
on entering to a function. In that case we do not need reordering and so
on.
2021-05-06 22:08:39 +03:00
9seconds 3cacd74e12 Correctly reset relay state 2021-03-29 14:36:02 +03:00
9seconds 4c3f42e264 Simplify relay 2021-03-29 10:37:09 +03:00
9seconds 336e825e3a Add wg to observer
This is to ensure a case when we still can have observer hanging around
2021-03-24 10:16:54 +03:00
9seconds 6b1bfe7b17 Add primitive relay tests 2021-03-24 10:08:04 +03:00
9seconds a3362c7ea4 Proxy is working in a simple mode now 2021-03-23 15:14:36 +03:00