mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-09-02 15:15:09 +00:00
Align NetworkPacket.hasPayload with desktop
Summary: On desktop NetworkPacket.hasPayload() tests m_payloadSize On android NetworkPacket.hasPayload() tests mPayload This patch makes android also test mPayloadSize to make things more consistent Reviewers: #kde_connect, albertvaka Reviewed By: #kde_connect, albertvaka Subscribers: kdeconnect Tags: #kde_connect Differential Revision: https://phabricator.kde.org/D17236
This commit is contained in:
@@ -150,7 +150,7 @@ public class LanLink extends BaseLink {
|
|||||||
|
|
||||||
//Prepare socket for the payload
|
//Prepare socket for the payload
|
||||||
final ServerSocket server;
|
final ServerSocket server;
|
||||||
if (np.hasPayload() && np.getPayloadSize() != 0) {
|
if (np.hasPayload()) {
|
||||||
server = LanLinkProvider.openServerSocketOnFreePort(LanLinkProvider.PAYLOAD_TRANSFER_MIN_PORT);
|
server = LanLinkProvider.openServerSocketOnFreePort(LanLinkProvider.PAYLOAD_TRANSFER_MIN_PORT);
|
||||||
JSONObject payloadTransferInfo = new JSONObject();
|
JSONObject payloadTransferInfo = new JSONObject();
|
||||||
payloadTransferInfo.put("port", server.getLocalPort());
|
payloadTransferInfo.put("port", server.getLocalPort());
|
||||||
@@ -263,7 +263,6 @@ public class LanLink extends BaseLink {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (np.hasPayloadTransferInfo()) {
|
if (np.hasPayloadTransferInfo()) {
|
||||||
|
|
||||||
Socket payloadSocket = new Socket();
|
Socket payloadSocket = new Socket();
|
||||||
try {
|
try {
|
||||||
int tcpPort = np.getPayloadTransferInfo().getInt("port");
|
int tcpPort = np.getPayloadTransferInfo().getInt("port");
|
||||||
|
@@ -309,7 +309,7 @@ public class NetworkPacket {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasPayload() {
|
public boolean hasPayload() {
|
||||||
return (mPayload != null);
|
return (mPayloadSize != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasPayloadTransferInfo() {
|
public boolean hasPayloadTransferInfo() {
|
||||||
|
Reference in New Issue
Block a user