mount: if already mounted, unmount before new attempt

This is because if the user specifies that they want
to mount multiple times, something must be wrong. try
unmounting to reset things and then proceed.
This commit is contained in:
Juan Batiz-Benet 2014-11-16 02:22:53 -08:00
parent 705465db8b
commit 93ad2bd057

View File

@ -98,6 +98,16 @@ baz
return nil, err
}
// check if we already have live mounts.
// if the user said "Mount", then there must be something wrong.
// so, close them and try again.
if node.Mounts.Ipfs != nil {
node.Mounts.Ipfs.Unmount()
}
if node.Mounts.Ipns != nil {
node.Mounts.Ipns.Unmount()
}
// error if we aren't running node in online mode
if node.Network == nil {
return nil, errNotOnline