summaryrefslogtreecommitdiff
path: root/same
diff options
context:
space:
mode:
authorKjetil Ørbekk <kjetil.orbekk@gmail.com>2012-02-14 13:22:54 +0100
committerKjetil Ørbekk <kjetil.orbekk@gmail.com>2012-02-14 13:22:54 +0100
commitebf3d3451e1a04e4f8b0c762fe6c0297884983e5 (patch)
tree5d480dcf4151f846d12e43293685cfa7b341fb68 /same
parent990f1cfeb54d7ef83a1ee465c95f53ce803c1b13 (diff)
same-android: Implement network joining.
Diffstat (limited to 'same')
-rw-r--r--same/src/main/java/com/orbekk/same/DiscoveryService.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/same/src/main/java/com/orbekk/same/DiscoveryService.java b/same/src/main/java/com/orbekk/same/DiscoveryService.java
index 0415316..d9af9bb 100644
--- a/same/src/main/java/com/orbekk/same/DiscoveryService.java
+++ b/same/src/main/java/com/orbekk/same/DiscoveryService.java
@@ -22,6 +22,10 @@ public class DiscoveryService extends Thread {
logger.info("DiscoveryService starting.");
while (!Thread.interrupted()) {
DatagramPacket packet = broadcastListener.listen();
+ if (packet == null) {
+ // An error or interrupt occurred.
+ continue;
+ }
String content = new String(packet.getData(), 0, packet.getLength());
String[] words = content.split(" ");