added retry to installer for synrgyhk.dll file delete problem, seems to help.

added hack to daemon to suppresses service controller false positive error.
tidied up a few of the log lines to make the place look nicer for newbies.
removed annoying build line from dist command.
This commit is contained in:
Nick Bolton 2012-07-05 21:26:41 +00:00
parent ddb2d7feeb
commit fbc4a89653
8 changed files with 62 additions and 24 deletions

View File

@ -174,6 +174,7 @@ Function avgToolbarInstall
${If} $avgInstallAll == 1 ${If} $avgInstallAll == 1
${OrIf} $avgInstallToolbar == 1 ${OrIf} $avgInstallToolbar == 1
${Orif} $avgInstallSearch == 1 ${Orif} $avgInstallSearch == 1
SetDetailsPrint none
File "..\res\avgtb.exe" File "..\res\avgtb.exe"
${Else} ${Else}
Return Return
@ -199,4 +200,6 @@ Function avgToolbarInstall
${EndIf} ${EndIf}
SetDetailsPrint both
FunctionEnd FunctionEnd

View File

@ -55,6 +55,37 @@ InstallDirRegKey HKEY_LOCAL_MACHINE "SOFTWARE\${product}" ""
Delete "${dir}\uninstall.exe" Delete "${dir}\uninstall.exe"
Delete "${dir}\synxinhk.dll" Delete "${dir}\synxinhk.dll"
Delete "${dir}\sxinpx13.dll" Delete "${dir}\sxinpx13.dll"
!define ID ${__LINE__}
; some programs hang on to the hook library, wait until they're done.
StrCpy $R0 0
retry${ID}:
${If} ${FileExists} "${dir}\synrgyhk.dll"
IntOp $R0 $R0 + 1
${If} $R0 < 60
; wait for handle on file to be released. why so long? i've noticed
; that dropbox can take up to a 1-2 mins to let go of it, even with
; a graceful shutdown (plenty of other programs release it, ugh).
Sleep 2000
DetailPrint "Trying to delete synrgyhk.dll (attempt $R0)"
Delete "${dir}\synrgyhk.dll"
Goto retry${ID}
${Else}
messageBox MB_OK \
"The file synrgyhk.dll could not be removed, as it is being used by \
another program. The setup may fail when trying to install the file, \
but you can safely retry this when prompted. If the problem persists, \
please restart your computer and re-run the setup."
Goto end${ID}
${EndIf}
${Else}
FileClose $R0
${EndIf}
end${ID}:
!undef ID
RMDir "${dir}" RMDir "${dir}"
!macroend !macroend
@ -67,6 +98,9 @@ Section
; stops and removes all services (including legacy) ; stops and removes all services (including legacy)
ExecWait "$INSTDIR\synergyd.exe /uninstall" ExecWait "$INSTDIR\synergyd.exe /uninstall"
; give the daemon a chance to close cleanly.
Sleep 2000
; force kill all synergy processes ; force kill all synergy processes
nsExec::Exec "taskkill /f /im synergy.exe" nsExec::Exec "taskkill /f /im synergy.exe"
nsExec::Exec "taskkill /f /im qsynergy.exe" nsExec::Exec "taskkill /f /im qsynergy.exe"
@ -131,18 +165,7 @@ Section "Server and Client" core
File "${binDir}\Release\synergys.exe" File "${binDir}\Release\synergys.exe"
File "${binDir}\Release\synergyc.exe" File "${binDir}\Release\synergyc.exe"
File "${binDir}\Release\synergyd.exe" File "${binDir}\Release\synergyd.exe"
File "${binDir}\Release\synrgyhk.dll"
; try to replace synrgyhk.dll
ClearErrors
FileOpen $R0 "synrgyhk.dll" w
${If} ${Errors}
messageBox MB_OK \
"Skipping the file synrgyhk.dll, which is being used by another program. \
To resolve this problem, please restart your computer and re-run setup."
${Else}
FileClose $R0
File "${binDir}\Release\synrgyhk.dll"
${EndIf}
; install and run the service ; install and run the service
ExecWait "$INSTDIR\synergyd.exe /install" ExecWait "$INSTDIR\synergyd.exe /install"
@ -186,6 +209,9 @@ Section Uninstall
; stop and uninstall the service ; stop and uninstall the service
ExecWait "$INSTDIR\synergyd.exe /uninstall" ExecWait "$INSTDIR\synergyd.exe /uninstall"
; give the daemon a chance to close cleanly.
Sleep 2000
; force kill all synergy processes ; force kill all synergy processes
nsExec::Exec "taskkill /f /im synergy.exe" nsExec::Exec "taskkill /f /im synergy.exe"
nsExec::Exec "taskkill /f /im qsynergy.exe" nsExec::Exec "taskkill /f /im qsynergy.exe"

View File

@ -35,16 +35,16 @@ IpcClient::~IpcClient()
void IpcClient::connected() void IpcClient::connected()
{ {
infoMessage("connected to background service");
char typeBuf[1]; char typeBuf[1];
typeBuf[0] = kIpcClientGui; typeBuf[0] = kIpcClientGui;
write(kIpcHello, 1, typeBuf); write(kIpcHello, 1, typeBuf);
infoMessage("connection established");
} }
void IpcClient::connectToHost() void IpcClient::connectToHost()
{ {
infoMessage("connecting to background service..."); infoMessage("connecting to service...");
m_Socket->connectToHost(QHostAddress(QHostAddress::LocalHost), IPC_PORT); m_Socket->connectToHost(QHostAddress(QHostAddress::LocalHost), IPC_PORT);
} }

View File

@ -126,7 +126,7 @@ CEventQueue::adoptBuffer(IEventQueueBuffer* buffer)
if (m_events.size() != 0) { if (m_events.size() != 0) {
// this can come as a nasty surprise to programmers expecting // this can come as a nasty surprise to programmers expecting
// their events to be raised, only to have them deleted. // their events to be raised, only to have them deleted.
LOG((CLOG_WARN "discarding %d event(s), sorry", m_events.size())); LOG((CLOG_DEBUG "discarding %d event(s)", m_events.size()));
} }
// discard old buffer and old events // discard old buffer and old events

View File

@ -64,7 +64,7 @@ CIpcServer::handleClientConnecting(const CEvent&, void*)
return; return;
} }
LOG((CLOG_NOTE "accepted ipc client connection")); LOG((CLOG_DEBUG "accepted ipc client connection"));
// TODO: delete on disconnect // TODO: delete on disconnect
CIpcClientProxy* proxy = new CIpcClientProxy(*stream); CIpcClientProxy* proxy = new CIpcClientProxy(*stream);

View File

@ -1234,7 +1234,7 @@ CServer::handleShapeChanged(const CEvent&, void* vclient)
return; return;
} }
LOG((CLOG_INFO "screen \"%s\" shape changed", getName(client).c_str())); LOG((CLOG_DEBUG "screen \"%s\" shape changed", getName(client).c_str()));
// update jump coordinate // update jump coordinate
SInt32 x, y; SInt32 x, y;

View File

@ -91,6 +91,7 @@ CDaemonApp::~CDaemonApp()
int int
CDaemonApp::run(int argc, char** argv) CDaemonApp::run(int argc, char** argv)
{ {
bool uninstall = false;
try try
{ {
#if SYSAPI_WIN32 #if SYSAPI_WIN32
@ -118,6 +119,7 @@ CDaemonApp::run(int argc, char** argv)
} }
#if SYSAPI_WIN32 #if SYSAPI_WIN32
else if (arg == "/install") { else if (arg == "/install") {
uninstall = true;
ARCH->installDaemon(); ARCH->installDaemon();
return kExitSuccess; return kExitSuccess;
} }
@ -150,7 +152,17 @@ CDaemonApp::run(int argc, char** argv)
return kExitSuccess; return kExitSuccess;
} }
catch (XArch& e) { catch (XArch& e) {
foregroundError(e.what().c_str()); CString message = e.what();
if (uninstall && (message.find("The service has not been started") != CString::npos)) {
// TODO: if we're keeping this use error code instead (what is it?!).
// HACK: this message happens intermittently, not sure where from but
// it's quite misleading for the user. they thing something has gone
// horribly wrong, but it's just the service manager reporting a false
// positive (the service has actually shut down in most cases).
}
else {
foregroundError(message.c_str());
}
return kExitFailed; return kExitFailed;
} }
catch (std::exception& e) { catch (std::exception& e) {
@ -269,7 +281,7 @@ CDaemonApp::logPath()
void void
CDaemonApp::handleIpcConnected(const CEvent& e, void*) CDaemonApp::handleIpcConnected(const CEvent& e, void*)
{ {
LOG((CLOG_INFO "ipc client connected")); LOG((CLOG_DEBUG "ipc client connected"));
EVENTQUEUE->adoptHandler( EVENTQUEUE->adoptHandler(
CIpcClientProxy::getMessageReceivedEvent(), e.getData(), CIpcClientProxy::getMessageReceivedEvent(), e.getData(),
new TMethodEventJob<CDaemonApp>( new TMethodEventJob<CDaemonApp>(

View File

@ -537,9 +537,6 @@ class InternalCommands:
if type != 'win' and type != 'mac': if type != 'win' and type != 'mac':
self.configure(unixTarget, '-DCONF_CPACK:BOOL=TRUE') self.configure(unixTarget, '-DCONF_CPACK:BOOL=TRUE')
# make sure we have a release build to package
self.build([self.defaultTarget], skipConfig=True)
moveExt = '' moveExt = ''
if type == None: if type == None: