Make libsmbclient more fail-safe

Andrew Bartlett abartlet at
Thu Nov 29 01:53:04 GMT 2001

Jeremy Allison wrote:
> On Wed, Nov 28, 2001 at 11:41:17PM +0100, Tom Jansen wrote:
> > Hi Richard,
> >
> > I've been working on a patch for libsmbclient that makes it even more reliable
> > regarding to server restarts, network failures etc.
> >
> > 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. I want to make sure a server is operational when I give back a
> > server from the server cache LL inside libsmbclient. I'm looking for a way to
> > send some sort of ping to the server. Is there a way to do this?
> Use a SMBkeepalive NetBIOS packet. Look at the send_keepalive()
> code in Samba.
> > I've got yet another question. Recently, Jeremy removed the "reestablish" code
> > from libsmb/clientgen.c. I would like to use a slighty modified version of this
> > code to recover from possible server-side disconnects or connection failures.
> > Can I move it back in the tree if my patch gets accepted ?
> 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
> application.
> Jeremy.

But a 'my connection went away and you asked me to do somthing' callback
mechinism would make sense, would it not?

Andrew Bartlett

Andrew Bartlett                                 abartlet at
Manager, Authentication Subsystems, Samba Team  abartlet at
Student Network Administrator, Hawker College   abartlet at

More information about the samba-technical mailing list