hierynomus/smbj

Question about connections and sessions reuse

proxymus89 opened this issue · 1 comments

Hi, I have a multi thread application with a single instance of SMBJ client. For every operation (download, upload, list, etc.) the program calls

connection = client.connect(rootAddress);
session = connection.authenticate(authContext);

the problem is that i see that the library reuse correctly the connection from the cache but not the session.

for example, if it calls 20 operations after these operations I will always have only one connection object (which it retrieves from the cache each time) while the sessionTable will be populated by 20 sessions (but I would expect only one)

So my question are:

  1. is correct my approach to call every time the "connection.authenticate(authContext)"?if yes, why it doesn't reuse allways the same session but creates every time a new one?

  2. if i don't close manually the connection and the session, they remain alive forever?exists a timeout?and how to set it? (the timeout in SmbConfig seems to be a different thing)

Hi,

I have similar issue and questions in a multithreaded env with a single client.

Moreover I wonder how the two SessionTable in Connection object are used, if, apparently, to retrieve a Session from a Connection, authenticate method is the only public way to do it and it does not reuse open sessions of the Connection.

Thanks