Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'loopback' into 'master'
[sailfishos][gecko] Hardcode loopback address for profile lock filename. JB#45654

See merge request mer-core/gecko-dev!186
  • Loading branch information
rainemak committed Nov 14, 2020
2 parents 8c53ad0 + 7b950ae commit 766e4cb
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
@@ -0,0 +1,42 @@
From cdc220c97fe1f02e950c113711f318e834c1120d Mon Sep 17 00:00:00 2001
From: Raine Makelainen <raine.makelainen@jolla.com>
Date: Fri, 13 Nov 2020 10:31:26 +0200
Subject: [PATCH] [sailfishos][gecko] Hardcode loopback address for profile
lock filename. JB#45654

When engine started without network PR_GetHostByName takes 20seconds
when connman tries to resolve host name. As this is only used as part of the
profile lock filename it can as well be like "127.0.0.1:+<pid>".

Signed-off-by: Raine Makelainen <raine.makelainen@jolla.com>
---
toolkit/profile/nsProfileLock.cpp | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/toolkit/profile/nsProfileLock.cpp b/toolkit/profile/nsProfileLock.cpp
index 3e6750f4250c..7fce74a80fa9 100644
--- a/toolkit/profile/nsProfileLock.cpp
+++ b/toolkit/profile/nsProfileLock.cpp
@@ -289,18 +289,8 @@ nsresult nsProfileLock::LockWithSymlink(nsIFile *aLockFile,
struct in_addr inaddr;
inaddr.s_addr = htonl(INADDR_LOOPBACK);

- char hostname[256];
- PRStatus status = PR_GetSystemInfo(PR_SI_HOSTNAME, hostname, sizeof hostname);
- if (status == PR_SUCCESS) {
- char netdbbuf[PR_NETDB_BUF_SIZE];
- PRHostEnt hostent;
- status = PR_GetHostByName(hostname, netdbbuf, sizeof netdbbuf, &hostent);
- if (status == PR_SUCCESS) memcpy(&inaddr, hostent.h_addr, sizeof inaddr);
- }
-
mozilla::SmprintfPointer signature =
- mozilla::Smprintf("%s:%s%lu", inet_ntoa(inaddr),
- aHaveFcntlLock ? "+" : "", (unsigned long)getpid());
+ mozilla::Smprintf("127.0.0.1:%s%lu", aHaveFcntlLock ? "+" : "", (unsigned long)getpid());
const char *fileName = lockFilePath.get();
int symlink_rv, symlink_errno = 0, tries = 0;

--
2.28.0

1 change: 1 addition & 0 deletions rpm/xulrunner-qt5.spec
Expand Up @@ -90,6 +90,7 @@ Patch44: 0044-sailfishos-gecko-Apply-UA-override-for-window.naviga.patch
Patch45: 0045-sailfishos-media-Ensure-audio-continues-when-screen-.patch
Patch46: 0046-sailfishos-backport--Make-MOZSIGNALTRAMPOLINE-Andro-.patch
Patch47: 0047-sailfishos-gecko-Force-recycling-of-gmpdroid-instanc.patch
Patch48: 0048-sailfishos-gecko-Hardcode-loopback-address-for-profi.patch

BuildRequires: rust
BuildRequires: rust-std-static
Expand Down

0 comments on commit 766e4cb

Please sign in to comment.