Skip to content

Commit 304d86f

Browse files
committed
Client will now notice if the server forgets to send a reply
- Added a new catch-clause, so the client will notice if the server forgets to send a reply (sendReply(Socket, Object...)). - Slightly improved Diffie Hellman Factory - Added Java version to contributing guidelines
1 parent 4b257fb commit 304d86f

3 files changed

Lines changed: 13 additions & 3 deletions

File tree

CONTRIBUTING.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Contributing Guidelines
2+
23
## Code Style
34
- Do not use a single line for a {, but put it at the end of the previous line
4-
- Do not leave { or } out if possible, e.g. when writing an if statement with just one line in its body
5-
- Do not change the line breaks of the Javadoc
5+
- Do not leave { or } out even if this is possible, e.g. when writing an if statement with just one line in its body
6+
- Do not change the line breaks of the Javadoc
7+
8+
## Java Version
9+
- Only use language features that are possible in Java 8 or earlier.
10+
11+
12+
Thank you for contributing!

src/com/blogspot/debukkitsblog/crypt/DHKeyFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public class DHKeyFactory {
1010
public DHKeyFactory() {
1111
System.out.println("[DHKey] Generating secure key...");
1212
p = new BigInteger(2048, 12, new Random());
13-
g = new BigInteger(String.valueOf(12 - new Random().nextInt(10)));
13+
g = new BigInteger(String.valueOf(4 - new Random().nextInt(3)));
1414
do {
1515
s = new BigInteger(160, new Random());
1616
} while (s.compareTo(new BigInteger("2")) == -1 || s.compareTo(p.subtract(new BigInteger("1"))) == 0);

src/com/blogspot/debukkitsblog/net/Client.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import java.io.BufferedInputStream;
44
import java.io.BufferedOutputStream;
5+
import java.io.EOFException;
56
import java.io.IOException;
67
import java.io.ObjectInputStream;
78
import java.io.ObjectOutputStream;
@@ -438,6 +439,8 @@ public Datapackage sendMessage(Datapackage message, int timeout) {
438439
if (raw instanceof Datapackage) {
439440
return (Datapackage) raw;
440441
}
442+
} catch(EOFException ex) {
443+
onLogError("[Client] Error right after sending message: EOFException (did the server forget to send a reply?)");
441444
} catch (IOException | ClassNotFoundException ex) {
442445
onLogError("[Client] Error while sending message");
443446
ex.printStackTrace();

0 commit comments

Comments
 (0)