Browse Source

Merge remote-tracking branch 'origin/subprojects' into subprojects

Arnaud Vergnet 3 years ago
parent
commit
2fc3a00264

+ 1
- 2
client/src/main/java/fr/insa/clavardator/client/users/DirectPeerConnection.java View File

@@ -10,8 +10,7 @@ import java.io.Serializable;
10 10
 public class DirectPeerConnection extends PeerConnection {
11 11
 	private final TcpConnection connection;
12 12
 
13
-	public DirectPeerConnection(TcpConnection connection, PeerUser user) {
14
-		super(user);
13
+	public DirectPeerConnection(TcpConnection connection) {
15 14
 		this.connection = connection;
16 15
 	}
17 16
 

+ 0
- 6
client/src/main/java/fr/insa/clavardator/client/users/PeerConnection.java View File

@@ -8,12 +8,6 @@ import org.jetbrains.annotations.Nullable;
8 8
 import java.io.Serializable;
9 9
 
10 10
 public abstract class PeerConnection {
11
-	protected final PeerUser user;
12
-
13
-	protected PeerConnection(PeerUser user) {
14
-		this.user = user;
15
-	}
16
-
17 11
 	protected abstract void send(Serializable message, @Nullable SimpleCallback calback, @Nullable ErrorCallback errorCallback);
18 12
 
19 13
 	/**

+ 2
- 2
client/src/main/java/fr/insa/clavardator/client/users/PeerUser.java View File

@@ -49,12 +49,12 @@ public class PeerUser extends User implements Comparable<PeerUser> {
49 49
 	}
50 50
 
51 51
 	public void init(TcpConnection tcpConnection, String id, String username, ErrorCallback errorCallback) {
52
-		connection = new DirectPeerConnection(tcpConnection, this);
52
+		connection = new DirectPeerConnection(tcpConnection);
53 53
 		init(id, username, errorCallback);
54 54
 	}
55 55
 
56 56
 	public void init(Proxy proxy, String id, String username, ErrorCallback errorCallback) {
57
-		connection = new ProxyPeerConnection(proxy, this);
57
+		connection = new ProxyPeerConnection(proxy, getId());
58 58
 		init(id, username, errorCallback);
59 59
 	}
60 60
 

+ 5
- 4
client/src/main/java/fr/insa/clavardator/client/users/ProxyPeerConnection.java View File

@@ -10,10 +10,11 @@ import java.io.Serializable;
10 10
 
11 11
 public class ProxyPeerConnection extends PeerConnection {
12 12
 	private final Proxy proxy;
13
+	private final String userId;
13 14
 
14
-	public ProxyPeerConnection(Proxy proxy, PeerUser user) {
15
-		super(user);
15
+	public ProxyPeerConnection(Proxy proxy, String userId) {
16 16
 		this.proxy = proxy;
17
+		this.userId = userId;
17 18
 	}
18 19
 
19 20
 	@Override
@@ -24,11 +25,11 @@ public class ProxyPeerConnection extends PeerConnection {
24 25
 
25 26
 	@Override
26 27
 	protected void receive(TcpConnection.MessageReceivedCallback callback, ErrorCallback errorCallback) {
27
-		proxy.receive(user.getId(), callback, errorCallback);
28
+		proxy.receive(userId, callback, errorCallback);
28 29
 	}
29 30
 
30 31
 	@Override
31 32
 	public void disconnect() {
32
-		proxy.disconnectUser(user.getId());
33
+		proxy.disconnectUser(userId);
33 34
 	}
34 35
 }

Loading…
Cancel
Save