From 65886d792d198528a7f35d8d59f8cfeaa5d34e1c Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Tue, 26 Jun 2012 23:52:01 -0500 Subject: Add skeleton for FPGA viewer Fix authserver crash --- servers/fpga_server_lin/src/fpga_conn.cpp | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'servers/fpga_server_lin/src/fpga_conn.cpp') 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 { -- cgit v1.2.1