diff options
author | Joey Hess <joey@kitenet.net> | 2013-05-02 22:38:45 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-05-02 22:38:45 -0400 |
commit | ed4e08d23a005d5f43151d271a35a99fccd9b978 (patch) | |
tree | 606cc3924d33f08af7a6a5d9ac3267ee115821f3 | |
parent | 64c5d51645d665e96bb3f2467692d9be88cbeefe (diff) |
work around strange endianness bug in port number on Android
-rw-r--r-- | Utility/WebApp.hs | 14 | ||||
-rw-r--r-- | debian/changelog | 6 | ||||
-rw-r--r-- | git-annex.cabal | 1 |
3 files changed, 20 insertions, 1 deletions
diff --git a/Utility/WebApp.hs b/Utility/WebApp.hs index 440d56fdf..0614384a1 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 67ef96867..5462ffb6a 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 <joeyh@debian.org> 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 6556711d7..11d327d15 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) |