Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions src/main/java/com/vexsoftware/votifier/net/VoteReceiver.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,15 @@ public class VoteReceiver extends Thread {
*/
public VoteReceiver(final Votifier plugin, String host, int port)
throws Exception {
super("Votifier I/O");

this.plugin = plugin;
this.host = host;
this.port = port;

// Set priority low so RSA decoding wouldn't have an impact in server performance
setPriority(Thread.MIN_PRIORITY);

initialize();
}

Expand All @@ -87,7 +92,7 @@ private void initialize() throws Exception {
LOG.log(Level.SEVERE,
"with hosting services and, if so, you should check with your hosting provider.",
ex);
throw new Exception(ex);
throw ex;
}
}

Expand Down Expand Up @@ -118,7 +123,7 @@ public void run() {
InputStream in = socket.getInputStream();

// Send them our version.
writer.write("VOTIFIER " + Votifier.getInstance().getVersion());
writer.write("VOTIFIER " + plugin.getVersion());
writer.newLine();
writer.flush();

Expand All @@ -127,8 +132,7 @@ public void run() {
in.read(block, 0, block.length);

// Decrypt the block.
block = RSA.decrypt(block, Votifier.getInstance().getKeyPair()
.getPrivate());
block = RSA.decrypt(block, plugin.getKeyPair().getPrivate());
int position = 0;

// Perform the opcode check.
Expand Down Expand Up @@ -160,8 +164,7 @@ public void run() {
LOG.info("Received vote record -> " + vote);

// Dispatch the vote to all listeners.
for (VoteListener listener : Votifier.getInstance()
.getListeners()) {
for (VoteListener listener : plugin.getListeners()) {
try {
listener.voteMade(vote);
} catch (Exception ex) {
Expand Down