Skip to content
Snippets Groups Projects
Commit 0235f806 authored by Martin Hustoles's avatar Martin Hustoles
Browse files

fsfadfsafs

parent 6d452194
No related branches found
No related tags found
No related merge requests found
File added
package cp; package cp;
public class CPCookie { public class CPCookie {
private int cookie;
private long createdAt;
CPCookie(long createdAt, int cookie){
this.createdAt = createdAt;
this.cookie = cookie;
}
public int getCookie() {
return cookie;
}
public long getCreatedAt() {
return createdAt;
}
} }
...@@ -112,6 +112,7 @@ public class CPProtocol extends Protocol { ...@@ -112,6 +112,7 @@ public class CPProtocol extends Protocol {
public void cookieProcesing(PhyConfiguration config, String cookie){ public void cookieProcesing(PhyConfiguration config, String cookie){
if(cookieMap.size() >= CP_HASHMAP_SIZE){ if(cookieMap.size() >= CP_HASHMAP_SIZE){
System.out.println("Too many cookies.");
return; return;
} }
...@@ -125,7 +126,7 @@ public class CPProtocol extends Protocol { ...@@ -125,7 +126,7 @@ public class CPProtocol extends Protocol {
CPCookieRequestMsg reqMsg = new CPCookieRequestMsg(); CPCookieRequestMsg reqMsg = new CPCookieRequestMsg();
reqMsg.create(null); reqMsg.create(null);
this.PhyProto.send(new String (reqMsg.getDataBytes()), this.PhyConfig); this.PhyProto .send(new String (reqMsg.getDataBytes()), this.PhyConfig);
Msg resMsg = new CPMsg(); Msg resMsg = new CPMsg();
try { try {
......
...@@ -37,4 +37,19 @@ public class PhyConfiguration extends Configuration{ ...@@ -37,4 +37,19 @@ public class PhyConfiguration extends Configuration{
public int hashCode(String cookie){ public int hashCode(String cookie){
return System.identityHashCode(cookie); return System.identityHashCode(cookie);
} }
//generated using Alt+Insert
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof PhyConfiguration that)) return false;
return remotePort == that.remotePort && isClient == that.isClient && Objects.equals(remoteIPAddress, that.remoteIPAddress) && pid == that.pid;
}
//generated using Alt+Insert
@Override
public int hashCode() {
return Objects.hash(remotePort, remoteIPAddress, pid, isClient);
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment