Make libsmbclient more fail-safe
t.p.j.jansen at student.utwente.nl
Thu Nov 29 02:16:01 GMT 2001
> > Now I've run into the following problem: How can I verify if a connection to a
> > SMB server is still operational? I can check if cli_state->fd != -1 but that is
> > not enough.
> Use a SMBkeepalive NetBIOS packet. Look at the send_keepalive()
> code in Samba.
I thought about that but I was not sure if it was allowed (confusing the other
side?) but I'll use this now.
> > [snip: put reestablishment code back in]
> Doing client re-establishment doesn't make sense in the
> client library (IMHO). It has no knowledge of the state
> needed (file open, locks held etc.). That belongs in the
No, that is true... but I was thinking in another direction:
libsmbclient.c code detects _server_ connection error and tries to reestablish
the connection because the server could have timed out or has been restarted.
Libsmbclient.c would then call cli_reestablish_connection(cli) which tries to
reestablish an identical connection to the server that failed. If it does not
succeed, there is nothing more we can do and all open smbc_fds for that
connection are useless. If it does succeed libsmbclient could try to first
smbc_close() and later smbc_open() the file again. This behaviour should be
configurable using some mechanism. I was thinking about an ioctl() like
interface: smbc_ctl(int smbc_fd, int request, ...) so it is expandable in the
Please tell me what you think about this.
PS cc to samba-technical
More information about the samba-technical