summaryrefslogtreecommitdiffstats
path: root/servers/fpga_server_lin/src
diff options
context:
space:
mode:
Diffstat (limited to 'servers/fpga_server_lin/src')
-rw-r--r--servers/fpga_server_lin/src/fpga_conn.cpp25
1 files changed, 13 insertions, 12 deletions
diff --git a/servers/fpga_server_lin/src/fpga_conn.cpp b/servers/fpga_server_lin/src/fpga_conn.cpp
index 1335a5a..ddd430a 100644
--- a/servers/fpga_server_lin/src/fpga_conn.cpp
+++ b/servers/fpga_server_lin/src/fpga_conn.cpp
@@ -40,6 +40,15 @@
#include "fpga_conn.h"
+#define ABORT_SOCKET(s) s->close(); \
+ tqApp->processEvents(); \
+ while (s->state() == TQSocket::Closing) { \
+ tqApp->processEvents(); \
+ } \
+ s->disconnect(); \
+ delete s; \
+ s = NULL;
+
/* exception handling */
struct exit_exception {
int c;
@@ -202,16 +211,12 @@ void FPGAServer::newConnection(int socket) {
printf("[DEBUG] New connection from %s\n\r", s->m_remoteHost.ascii());
if (m_numberOfConnections > 0) {
printf("[DEBUG] Connection from %s closed due to multiple access attempt\n\r", s->m_remoteHost.ascii());
- s->close();
- delete s;
- s = NULL;
+ ABORT_SOCKET(s)
return;
}
if (s->initiateKerberosHandshake() != 0) {
printf("[DEBUG] Connection from %s closed due to Kerberos failure\n\r", s->m_remoteHost.ascii());
- s->close();
- delete s;
- s = NULL;
+ ABORT_SOCKET(s)
return;
}
m_config->setGroup("Security");
@@ -222,16 +227,12 @@ void FPGAServer::newConnection(int socket) {
}
if ((s->m_authenticatedUserName != masterUser) || (s->m_authenticatedRealmName != masterRealm)) {
printf("[DEBUG] Connection from %s closed due to authentication failure (attempted connection as user %s@%s)\n\r", s->m_remoteHost.ascii(), masterUser.ascii(), masterRealm.ascii());
- s->close();
- delete s;
- s = NULL;
+ ABORT_SOCKET(s)
return;
}
if (s->setupSerial() != 0) {
printf("[DEBUG] Connection from %s closed due to serial port initialization failure\n\r", s->m_remoteHost.ascii());
- s->close();
- delete s;
- s = NULL;
+ ABORT_SOCKET(s)
return;
}
else {