diff --git a/exec/irc.js b/exec/irc.js
index a0c7991a1786dc0df61007cbab8725c10b42df93..9adfa80798378b86a0d744362facb72b75cf33a3 100644
--- a/exec/irc.js
+++ b/exec/irc.js
@@ -664,6 +664,9 @@ function wait_for(commands)  {
 		// Don't handle user input at this point!
 		// screen.update();
 	}
+	alert("Connection timed out");
+	sock.close();
+	clean_exit();
 }
 
 function in_a_channel() {