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.tags/v2.0.1^2
|
|
||
| 68 |
|
68 |
|
| 69 |
|
69 |
|
| 70 |
|
70 |
|
|
71 |
|
|
|
72 |
|
|
| 71 |
|
73 |
|
|
74 |
|
|
| 72 |
|
75 |
|
| 73 |
|
76 |
|
| 74 |
|
|
|
| 75 |
|
|
|
| 76 |
|
77 |
|
| 77 |
|
78 |
|
| 78 |
|
79 |
|
|
|
||
| 92 |
|
93 |
|
| 93 |
|
94 |
|
| 94 |
|
95 |
|
|
96 |
|
|
|
97 |
|
|
| 95 |
|
98 |
|
| 96 |
|
99 |
|
| 97 |
|
100 |
|
|
|
||
| 104 |
|
107 |
|
| 105 |
|
108 |
|
| 106 |
|
109 |
|
| 107 |
|
|
|
| 108 |
|
|
|
| 109 |
|
110 |
|
| 110 |
|
111 |
|
| 111 |
|
112 |
|