You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We spawn a go-routines when messages arrives - so we need to restrict their count via semaphore which is not a complete solution and will behave like a buffer (and it's better to use buffers as buffers and move calculation of buffer size to compiler)
We can't spawn a go-routine per 1-1 connection because message once read will never arrive to another inport
Both buffer and semaphore solution allow unnecessary blocking
Current implementation of connector that uses semaphores instead of buffers has bug that leads to unnecessary blocks.
Example:
fastest
be sender andslow1
,slow2
andfast
(order is important) are receivers (semaphore's buffer is empty, it's cap is 3)fastest
sends a message andslow1
,slow2
andfast
receives it (semaphore's buffer is full)fastest
arrives -fast
already did the job and ready for new data, butslow1
andslow2
are still busy (semaphore's buffer is 2)slow1
although it can't receive it yet (semaphore's buffer is 3 again)fast
receiver didn't receive the message although it could handle itThe text was updated successfully, but these errors were encountered: