You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I wrote a file sync application to sync changes in a local repository to a remote SMB share. Everything is working perfectly so far, except when the program is idle for too long. Seems to take maybe 10-15 minutes. Data is not being sent all the time, I have a select statement that waits on a message from a channel about local changes. Then, depending on the type of change, it applies those changes to the share. Users can sometimes go a little while between saves, so the application will be idle for too long and the connection will reset. They then have to restart the application. I couldn't find anything about a timeout or something similar in the code, and setting a deadline of 0 on the conn.Conn type did nothing. Is something that I would be able to fix, or is this an issue with SMB, or my SMB server specifically?
Error message with some information redacted:
2022/09/16 10:36:30 open Program Files\x\x\x\x.html: connection error: read tcp [ip:port]->[ip:port]: read: connection reset by peer
The only workaround I can think of is to have a goroutine stat a file every few minutes, but that doesn't feel right.
The text was updated successfully, but these errors were encountered:
conn, err:=net.Dial("tcp", server)
iferr!=nil {
log.Fatal(err)
}
deferconn.Close()
conn.SetDeadline(time.Time{}) // this did not resolve the issued:=&smb2.Dialer{
Initiator: &smb2.NTLMInitiator{
User: settings.Username,
Password: settings.Password,
},
}
s, err:=d.Dial(conn)
iferr!=nil {
log.Fatal(err)
}
defers.Logoff()
share, err:=s.Mount("C")
iferr!=nil {
log.Fatal(err)
}
defershare.Umount()
gofunc() {
for {
select {
[...] // application will hang here until local changes are made
}
}
}()
Hello, I wrote a file sync application to sync changes in a local repository to a remote SMB share. Everything is working perfectly so far, except when the program is idle for too long. Seems to take maybe 10-15 minutes. Data is not being sent all the time, I have a select statement that waits on a message from a channel about local changes. Then, depending on the type of change, it applies those changes to the share. Users can sometimes go a little while between saves, so the application will be idle for too long and the connection will reset. They then have to restart the application. I couldn't find anything about a timeout or something similar in the code, and setting a deadline of 0 on the
conn.Conn
type did nothing. Is something that I would be able to fix, or is this an issue with SMB, or my SMB server specifically?Error message with some information redacted:
The only workaround I can think of is to have a goroutine stat a file every few minutes, but that doesn't feel right.
The text was updated successfully, but these errors were encountered: