Skip to content

Commit

Permalink
add URI ping target param, preparation v1.3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
thexmanxyz committed Jan 10, 2018
1 parent 92f906f commit 81fb0d4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Many claim that the reconnect problem leads back to a timing problem during logi
* little knowledge on Windows Task Scheduling

## Download / Installation
1. [Download v1.3.3](https://github.com/thexmanxyz/network-share-reconnecter/releases/download/v1.3.3/nsr.v1.3.3.zip) of the Network Share Reconnecter Package.
1. [Download v1.3.4](https://github.com/thexmanxyz/network-share-reconnecter/releases/download/v1.3.4/nsr.v1.3.4.zip) of the Network Share Reconnecter Package.
2. Extract the files.
3. Modify the sample configuration in the **share_reconnect.vbs** script file.
* At least modify `hostname`, `sharePaths` and `shareLetters` (see also the [configuration section](https://github.com/thexmanxyz/network-share-reconnecter/blob/master/src/share_reconnect.vbs#L41-L43) and [Issue #1](https://github.com/thexmanxyz/network-share-reconnecter/issues/1)).
Expand Down Expand Up @@ -43,6 +43,7 @@ Here a short description of the available parameters which can be configured:
* `netUseCtn` - how many *net use* fails per reconnect are allowed before giving up
* `serverRetryCtn` - how many overall reconnection tries should be executed
* `pingTimeout` - how many milliseconds pass before the ping is canceled
* `pingDefaultSrv` - use common server if target service rejects pings **(URI only)**
* `debug` - enable or disable debug messages on current reconnection state

### UNC Sample Configuration
Expand Down
2 changes: 1 addition & 1 deletion build/build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ set log_files=0

REM --- Packaging Variables --
set prj_id=nsr
set prj_rev=v1.3.3
set prj_rev=v1.3.4
set prj_fullname=Network Share Reconnecter

REM --- File Variables ---
Expand Down
16 changes: 14 additions & 2 deletions src/share_reconnect.vbs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ srvConfigs = Array(srvCfg1, srvCfg2, srvCfg3)
' netUseCtn - how many net use fails per reconnect are allowed before giving up '
' serverRetryCtn - how many overall reconnection tries should be executed '
' pingTimeout - how many milliseconds pass before the ping is canceled '
' pingDefaultSrv - use common server if target service rejects pings (URI only) '
' debug - enable or disable debug messages on current reconnection state '
'-------------------------------------------------------------------------------------'

Expand All @@ -70,6 +71,7 @@ scriptConfig.pingCtn = 2
scriptConfig.netUseCtn = 1
scriptConfig.serverRetryCtn = 75
scriptConfig.pingTimeout = 200
scriptConfig.pingDefaultSrv = false
scriptConfig.debug = false

'--------------'
Expand Down Expand Up @@ -108,6 +110,7 @@ Class ScriptConfiguration
Public netUseCtn
Public serverRetryCtn
Public pingTimeout
Public pingDefaultSrv
Public winMgmts
Public shell
Public fso
Expand Down Expand Up @@ -400,8 +403,17 @@ End Function
'-------------------------------------------------------------'

Function getWMIPingCmd(scriptConfig, srvConfig)
Dim hostname

'use default ping target if defined and server is URI target
If scriptConfig.pingDefaultSrv And srvConfig.isUri Then
hostname = "8.8.8.8"
Else
hostname = srvConfig.hostname
End If

getWMIPingCmd = "select * from Win32_PingStatus where TimeOut = " _
& scriptConfig.pingTimeout & " and address = '" & srvConfig.hostname & "'"
& scriptConfig.pingTimeout & " and address = '" & hostname & "'"
End Function

'-----------------------------------------------------------------'
Expand Down Expand Up @@ -587,7 +599,7 @@ Function getReconWaitTime(scriptConfig, retries)

If retries <= 15 Then
reconWait = scriptConfig.reconWait
ElseIF retries > 15 And retries <= 30 Then
ElseIf retries > 15 And retries <= 30 Then
reconWait = scriptConfig.reconWait * 4
ElseIf retries > 30 And retries <= 45 Then
reconWait = scriptConfig.reconWait * 6
Expand Down

0 comments on commit 81fb0d4

Please sign in to comment.