@cryptotaxi247 / kubo / commits / 93ad2bd05

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.

Juan Batiz-Benet committed Nov 16, 2014 at 02:22 UTC 93ad2bd057baa3ac4b237a9ecc4e18ac886b3ead
1 file changed +10
core/commands2/mount_unix.go
+10
@@ -98,6 +98,16 @@ baz
98 return nil, err
99 }
100
101 + // check if we already have live mounts.
102 + // if the user said "Mount", then there must be something wrong.
103 + // so, close them and try again.
104 + if node.Mounts.Ipfs != nil {
105 + node.Mounts.Ipfs.Unmount()
106 + }
107 + if node.Mounts.Ipns != nil {
108 + node.Mounts.Ipns.Unmount()
109 + }
110 +
111 // error if we aren't running node in online mode
112 if node.Network == nil {
113 return nil, errNotOnline