diff --git a/Utility/WebApp.hs b/Utility/WebApp.hs index 440d56fdf6..0614384a13 100644 --- a/Utility/WebApp.hs +++ b/Utility/WebApp.hs @@ -36,6 +36,9 @@ import Blaze.ByteString.Builder (Builder) import Data.Monoid import Control.Arrow ((***)) import Control.Concurrent +#ifdef __ANDROID__ +import Data.Endian +#endif localhost :: HostName localhost = "localhost" @@ -63,7 +66,16 @@ runWebApp :: Maybe HostName -> Wai.Application -> (SockAddr -> IO ()) -> IO () runWebApp h app observer = do sock <- getSocket h void $ forkIO $ runSettingsSocket webAppSettings sock app - observer =<< getSocketName sock + sockaddr <- fixSockAddr <$> getSocketName sock + observer sockaddr + +fixSockAddr :: SockAddr -> SockAddr +#ifdef __ANDROID__ +{- On Android, the port is currently incorrectly returned in network + - byte order, which is wrong on little endian systems. -} +fixSockAddr (SockAddrInet (PortNum port) addr) = SockAddrInet (PortNum $ swapEndian port) addr +#endif +fixSockAddr addr = addr webAppSettings :: Settings webAppSettings = defaultSettings diff --git a/debian/changelog b/debian/changelog index 67ef96867a..5462ffb6ad 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +git-annex (4.20130502) UNRELEASED; urgency=low + + * Android: The webapp is ported and working. + + -- Joey Hess Thu, 02 May 2013 20:39:19 -0400 + git-annex (4.20130501) unstable; urgency=low * sync, assistant: Behavior changes: Sync with remotes that have diff --git a/git-annex.cabal b/git-annex.cabal index 6556711d76..11d327d150 100644 --- a/git-annex.cabal +++ b/git-annex.cabal @@ -100,6 +100,7 @@ Executable git-annex CPP-Options: -DWITH_ASSISTANT if flag(Android) + Build-Depends: data-endian CPP-Options: -D__ANDROID__ if os(linux) && flag(Inotify)