|
@@ -80,28 +80,18 @@ func NewServerMessageBlockFileSystemAbstraction(uuid string, hierarchy string, i
|
|
|
}
|
|
|
|
|
|
//Create a ticker to check for renewing conncetion once an hour
|
|
|
- ticker := time.NewTicker(1 * time.Hour)
|
|
|
+ ticker := time.NewTicker(5 * time.Minute)
|
|
|
go func(s *ServerMessageBlockFileSystemAbstraction) {
|
|
|
for {
|
|
|
select {
|
|
|
case <-done:
|
|
|
return
|
|
|
case <-ticker.C:
|
|
|
- //Unable to list share due to session timeout. Close the handler and try connecting again.
|
|
|
- s.share.Umount()
|
|
|
- time.Sleep(300 * time.Millisecond)
|
|
|
- fs, err := s.session.Mount(s.root)
|
|
|
- if err != nil {
|
|
|
- fmt.Println("[SMBFS] Unable to remount " + s.root)
|
|
|
- return
|
|
|
- }
|
|
|
- fmt.Println("[SMBFS] Session Renewed for " + s.root)
|
|
|
- s.share = fs
|
|
|
+ //Ping the smb server to make sure it knows we are alive
|
|
|
+ s.share.Stat("")
|
|
|
}
|
|
|
}
|
|
|
}(&fsAbstraction)
|
|
|
-
|
|
|
- log.Println("[SMB-FS] Connected to remote: " + ipaddr)
|
|
|
return fsAbstraction, nil
|
|
|
}
|
|
|
|