diff --git a/default/default.lua b/default/default.lua index 4d3f5e1..5608ea4 100644 --- a/default/default.lua +++ b/default/default.lua @@ -255,49 +255,6 @@ default.maxDelays = 1000 default.maxProcesses = 1 --- --- Exitcodes of rsync and what to do. --- TODO move to rsync --- -default.rsyncExitCodes = { - - -- - -- if another config provides the same table - -- this will not be inherited (merged) into that one - -- - -- if it does not, integer keys are to be copied - -- verbatim - -- - _merge = false, - _verbatim = true, - - [ 0 ] = 'ok', - [ 1 ] = 'die', - [ 2 ] = 'die', - [ 3 ] = 'again', - [ 4 ] = 'die', - [ 5 ] = 'again', - [ 6 ] = 'again', - [ 10 ] = 'again', - [ 11 ] = 'again', - [ 12 ] = 'again', - [ 14 ] = 'again', - [ 20 ] = 'again', - [ 21 ] = 'again', - [ 22 ] = 'again', - - -- partial transfers are ok, since Lsyncd has registered the event that - -- caused the transfer to be partial and will recall rsync. - [ 23 ] = 'ok', - [ 24 ] = 'ok', - - [ 25 ] = 'die', - [ 30 ] = 'again', - [ 35 ] = 'again', - - [ 255 ] = 'again', -} - -- -- Exitcodes of ssh and what to do. diff --git a/default/rsync.lua b/default/rsync.lua index baeba44..347f49b 100644 --- a/default/rsync.lua +++ b/default/rsync.lua @@ -630,9 +630,46 @@ end rsync.delete = true -- --- Rsyncd exitcodes +-- Exitcodes of rsync and what to do. -- -rsync.exitcodes = default.rsyncExitCodes +rsync.exitcodes = +{ + -- + -- if another config provides the same table + -- this will not be inherited (merged) into that one + -- + -- if it does not, integer keys are to be copied + -- verbatim + -- + _verbatim = true, + + [ 0 ] = 'ok', + [ 1 ] = 'die', + [ 2 ] = 'die', + [ 3 ] = 'again', + [ 4 ] = 'die', + [ 5 ] = 'again', + [ 6 ] = 'again', + [ 10 ] = 'again', + [ 11 ] = 'again', + [ 12 ] = 'again', + [ 14 ] = 'again', + [ 20 ] = 'again', + [ 21 ] = 'again', + [ 22 ] = 'again', + + -- partial transfers are ok, since Lsyncd has registered the event that + -- caused the transfer to be partial and will recall rsync. + [ 23 ] = 'ok', + [ 24 ] = 'ok', + + [ 25 ] = 'die', + [ 30 ] = 'again', + [ 35 ] = 'again', + + [ 255 ] = 'again', +} + -- -- Calls rsync with this default options diff --git a/default/rsyncssh.lua b/default/rsyncssh.lua index d71bd50..04c6101 100644 --- a/default/rsyncssh.lua +++ b/default/rsyncssh.lua @@ -568,7 +568,7 @@ rsyncssh.exitcodes = false -- -- rsync exit codes -- -rsyncssh.rsyncExitCodes = default.rsyncExitCodes +rsyncssh.rsyncExitCodes = rsync.exitCodes -- -- ssh exit codes diff --git a/default/signal.lua b/default/signal.lua index 237744f..ec9348d 100644 --- a/default/signal.lua +++ b/default/signal.lua @@ -94,6 +94,7 @@ init = local hup = getsignal( 'HUP' ) local int = getsignal( 'INT' ) local term = getsignal( 'TERM' ) + local usr1 = getsignal( 'USR1' ) if hup ~= false then @@ -110,6 +111,11 @@ init = term = makeSignalHandler( 'TERM', 'TERM', 'terminating', finishTerm ) end - onsignal( 'HUP', hup, 'INT', int, 'TERM', term ) + if usr1 ~= false + then + usr1 = makeSignalHandler( 'USR1', nil, 'terminating', finishTerm ) + end + + onsignal( 'HUP', hup, 'INT', int, 'TERM', term, 'USR1', usr1 ) end diff --git a/mantle/mci.lua b/mantle/mci.lua index dbdd517..e320a4d 100644 --- a/mantle/mci.lua +++ b/mantle/mci.lua @@ -592,39 +592,3 @@ function mci.overflow lsyncdStatus = 'fade' end --- --- Called by core on a hup signal. --- FIXME remove --- -function mci.hup -( ) - log( 'Normal', '--- HUP signal, resetting ---' ) - - lsyncdStatus = 'fade' -end - - --- --- Called by core on a term signal. --- FIXME remove --- -function mci.term -( - sigcode -- signal code -) - local sigtexts = - { - [ 2 ] = 'INT', - [ 15 ] = 'TERM' - } - - local sigtext = sigtexts[ sigcode ] - - if not sigtext then sigtext = 'UNKNOWN' end - - log( 'Normal', '--- ', sigtext, ' signal, fading ---' ) - - lsyncdStatus = 'fade' - -end - diff --git a/mantle/syncmaster.lua b/mantle/syncmaster.lua index 4f0700d..bb8b429 100644 --- a/mantle/syncmaster.lua +++ b/mantle/syncmaster.lua @@ -87,7 +87,7 @@ end local inheritKV -- --- Recurvely inherits a source table to a destionation table +-- Recursevly inherits a source table to a destionation table -- copying all keys from source. -- -- All entries with integer keys are inherited as additional @@ -108,17 +108,14 @@ local function inherit -- non-integer keys for k, v in pairs( cs ) do - if - ( - type( k ) ~= 'number' - or verbatim - or cs._verbatim == true - ) - and - ( - type( cs._merge ) ~= 'table' - or cs._merge[ k ] == true - ) + if ( + type( k ) ~= 'number' + or verbatim + or cs._verbatim == true + ) and ( + type( cs._merge ) ~= 'table' + or cs._merge[ k ] == true + ) then inheritKV( cd, k, v ) end @@ -340,10 +337,7 @@ local function concerns ) for _, s in ipairs( syncList ) do - if s:concerns( path ) - then - return true - end + if s:concerns( path ) then return true end end return false