contest: split wsjtx listener from other listeners

Even though the wsjtx code listens for network packets, it isn't just
another listener - it's the second method for contact entry.  Therefore,
let's move the wsjtx_start call right next to the UI start code where it
makes better sense.

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
1 files changed, 17 insertions(+), 11 deletions(-)

M hlog/contest.c
M hlog/contest.c +17 -11
@@ 148,16 148,8 @@ static int start_listeners(uint32_t rig_
 			goto err_rig;
 	}
 
-	ret = wsjtx_start();
-	if (ret)
-		goto err_loc;
-
 	return 0;
 
-err_loc:
-	if (gpsd_port)
-		location_stop();
-
 err_rig:
 	rig_stop();
 

          
@@ 169,7 161,6 @@ err:
 
 static void stop_listeners(const char *gpsd_port)
 {
-	wsjtx_stop();
 	if (gpsd_port)
 		location_stop();
 	rig_stop();

          
@@ 389,11 380,26 @@ int main(int argc, char **argv)
 		goto err_free;
 	}
 
-	if (!export)
+	if (!export) {
+		/*
+		 * Operating in a contest.  Start all the "subsystems" that
+		 * can log entries.  Namely, start:
+		 *
+		 *  1. ncurses ui
+		 *  2. wsjtx udp listener
+		 */
+		ret = wsjtx_start();
+		if (ret)
+			goto err_script;
+
 		ret = contest_ui_run(lua, &contest_params, wfields, nwfields);
-	else
+
+		wsjtx_stop();
+	} else {
 		ret = do_export(lua, &contest_params, export);
+	}
 
+err_script:
 	xlua_close(lua);
 
 err_free: