- simplified main() now that RCONSession really cannot ever be null

Tue, 16 Dec 2014 03:27:54 +0200

author
Teemu Piippo <crimsondusk64@gmail.com>
date
Tue, 16 Dec 2014 03:27:54 +0200
changeset 59
00a084f8ed26
parent 58
d175243ad169
child 60
268721e6be20

- simplified main() now that RCONSession really cannot ever be null

sources/main.cpp file | annotate | diff | comparison | revisions
--- a/sources/main.cpp	Tue Dec 16 02:48:18 2014 +0200
+++ b/sources/main.cpp	Tue Dec 16 03:27:54 2014 +0200
@@ -64,11 +64,9 @@
 			timeout.tv_usec = 250000; // 0.25 seconds
 			FD_ZERO (&fdset);
 			FD_SET (0, &fdset);
-			RCONSession* session = RCONSession::get_session();
 
-			if (session)
 			{
-				int fd = session->socket()->file_descriptor();
+				int fd = RCONSession::get_session()->socket()->file_descriptor();
 				highest = max (highest, fd);
 				FD_SET (fd, &fdset);
 			}
@@ -79,16 +77,12 @@
 				// stdin is ready, what's incoming?
 				Interface::handle_input();
 
-			if (session)
-				session->tick();
-
+			RCONSession::get_session()->tick();
 			Interface::render();
 		}
 	}
 	catch (const Exitception&) {}
 
-	if (RCONSession::get_session())
-		RCONSession::get_session()->disconnect();
-
+	RCONSession::get_session()->disconnect();
 	return EXIT_SUCCESS;
 }

mercurial