diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-06-26 23:52:01 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-06-26 23:52:01 -0500 |
commit | 65886d792d198528a7f35d8d59f8cfeaa5d34e1c (patch) | |
tree | b83ca439b0b7e6a4d6ff8d6ed1de1f22c6a91f97 /servers/fpga_server_lin/src/fpga_conn.cpp | |
parent | 9c9085621bf01f9b39e15eb856ff521ecb01fccf (diff) | |
download | ulab-65886d792d198528a7f35d8d59f8cfeaa5d34e1c.tar.gz ulab-65886d792d198528a7f35d8d59f8cfeaa5d34e1c.zip |
Add skeleton for FPGA viewer
Fix authserver crash
Diffstat (limited to 'servers/fpga_server_lin/src/fpga_conn.cpp')
-rw-r--r-- | servers/fpga_server_lin/src/fpga_conn.cpp | 25 |
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 { |