Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions src/main/java/org/filesys/netbios/server/NetBIOSNameServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ else if (m_hshutdown == true)
boolean txsts = true;
int retry = 0;

while (req.hasErrorStatus() == false && retry++ < reqRetry) {
retryLoop: while (req.hasErrorStatus() == false && retry++ < reqRetry) {

// Debug
if (Debug.EnableInfo && hasDebug())
Expand All @@ -210,6 +210,9 @@ else if (m_hshutdown == true)
// Add name request
case ADD_NAME:

// The server is shutting down, we can stop handling ADD_NAME
if (m_shutdown)
break retryLoop;
// Check if a WINS server is configured
if (hasPrimaryWINSServer())
txsts = sendAddName(req, getPrimaryWINSServer(), false);
Expand All @@ -230,6 +233,9 @@ else if (m_hshutdown == true)
// Refresh name request
case REFRESH_NAME:

// The server is shutting down, we can stop handling REFRESH_NAME
if (m_shutdown)
break retryLoop;
// Check if a WINS server is configured
if (hasPrimaryWINSServer())
txsts = sendRefreshName(req, getPrimaryWINSServer(), false);
Expand Down Expand Up @@ -724,7 +730,7 @@ public final synchronized void AddName(NetBIOSName name)
throw new IOException("NetBIOS name socket not initialized");

// Create an add name request and add to the request list
NetBIOSRequest nbReq = new NetBIOSRequest(NetBIOSRequest.Type.ADD_NAME, name, getNextTransactionId());
NetBIOSRequest nbReq = new NetBIOSRequest(NetBIOSRequest.Type.ADD_NAME, name, getNextTransactionId(), AddNameRetries);

// Set the retry interval
if (hasPrimaryWINSServer())
Expand Down Expand Up @@ -1617,6 +1623,9 @@ public void shutdownServer(boolean immediate) {
Debug.println(ex);
}

// Indicate that the server is closing
m_shutdown = true;

// If the shutdown is not immediate then release all of the names registered by this server
if (isActive() && immediate == false) {

Expand Down Expand Up @@ -1663,9 +1672,6 @@ public void shutdownServer(boolean immediate) {
Debug.println(ex);
}

// Indicate that the server is closing
m_shutdown = true;

try {

// Close the server socket so that any pending receive is cancelled
Expand Down