remotedaemon: Fix problem that could prevent ssh connections being made after two LOSTNET messages were received in a row

Perhaps due to two different network interfaces being brought down.

Since there is no reliable way to drain a Chan, I switched to STM TChan.
This commit is contained in:
Joey Hess 2015-01-15 15:37:48 -04:00
parent ec90116851
commit 1ce8367417
6 changed files with 44 additions and 19 deletions

View file

@ -17,6 +17,7 @@ import qualified Utility.SimpleProtocol as Proto
import Network.URI
import Control.Concurrent
import Control.Concurrent.STM
-- The URI of a remote is used to uniquely identify it (names change..)
newtype RemoteURI = RemoteURI URI
@ -24,7 +25,7 @@ newtype RemoteURI = RemoteURI URI
-- A Transport for a particular git remote consumes some messages
-- from a Chan, and emits others to another Chan.
type Transport = RemoteRepo -> RemoteURI -> TransportHandle -> Chan Consumed -> Chan Emitted -> IO ()
type Transport = RemoteRepo -> RemoteURI -> TransportHandle -> TChan Consumed -> TChan Emitted -> IO ()
type RemoteRepo = Git.Repo
type LocalRepo = Git.Repo