Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 571c8d71 authored by Elliott Hughes's avatar Elliott Hughes Committed by Gerrit Code Review
Browse files

Merge "Increase size of the the adb packets sent over the wire"

parents f5b46079 3d2904cd
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -334,10 +334,10 @@ void send_connect(atransport *t)
    D("Calling send_connect \n");
    apacket *cp = get_apacket();
    cp->msg.command = A_CNXN;
    cp->msg.arg0 = A_VERSION;
    cp->msg.arg1 = MAX_PAYLOAD;
    cp->msg.arg0 = t->get_protocol_version();
    cp->msg.arg1 = t->get_max_payload();
    cp->msg.data_length = fill_connect_data((char *)cp->data,
                                            sizeof(cp->data));
                                            MAX_PAYLOAD_V1);
    send_packet(cp, t);
}

@@ -424,12 +424,12 @@ void handle_packet(apacket *p, atransport *t)
        return;

    case A_CNXN: /* CONNECT(version, maxdata, "system-id-string") */
            /* XXX verify version, etc */
        if(t->connection_state != kCsOffline) {
            t->connection_state = kCsOffline;
            handle_offline(t);
        }

        t->update_version(p->msg.arg0, p->msg.arg1);
        parse_banner(reinterpret_cast<const char*>(p->data), t);

        if (HOST || !auth_required) {
+14 −1
Original line number Diff line number Diff line
@@ -25,7 +25,9 @@
#include "adb_trace.h"
#include "fdevent.h"

#define MAX_PAYLOAD 4096
constexpr size_t MAX_PAYLOAD_V1 = 4 * 1024;
constexpr size_t MAX_PAYLOAD_V2 = 256 * 1024;
constexpr size_t MAX_PAYLOAD = MAX_PAYLOAD_V2;

#define A_SYNC 0x434e5953
#define A_CNXN 0x4e584e43
@@ -137,6 +139,8 @@ struct asocket {

        /* A socket is bound to atransport */
    atransport *transport;

    size_t get_max_payload() const;
};


@@ -193,6 +197,8 @@ public:
    atransport() {
        auth_fde = {};
        transport_fde = {};
        protocol_version = A_VERSION;
        max_payload = MAX_PAYLOAD;
    }

    virtual ~atransport() {}
@@ -234,7 +240,14 @@ public:

    const char* connection_state_name() const;

    void update_version(int version, size_t payload);
    int get_protocol_version() const;
    size_t get_max_payload() const;

private:
    int protocol_version;
    size_t max_payload;

    DISALLOW_COPY_AND_ASSIGN(atransport);
};

+1 −1
Original line number Diff line number Diff line
@@ -75,7 +75,7 @@ void send_auth_publickey(atransport *t)
    apacket *p = get_apacket();
    int ret;

    ret = adb_auth_get_userkey(p->data, sizeof(p->data));
    ret = adb_auth_get_userkey(p->data, MAX_PAYLOAD_V1);
    if (!ret) {
        D("Failed to get user public key\n");
        put_apacket(p);
+2 −2
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@ static bool needs_retry = false;
static void read_keys(const char *file, struct listnode *list)
{
    FILE *f;
    char buf[MAX_PAYLOAD];
    char buf[MAX_PAYLOAD_V1];
    char *sep;
    int ret;

@@ -191,7 +191,7 @@ static void adb_auth_event(int fd, unsigned events, void *data)

void adb_auth_confirm_key(unsigned char *key, size_t len, atransport *t)
{
    char msg[MAX_PAYLOAD];
    char msg[MAX_PAYLOAD_V1];
    int ret;

    if (!usb_transport) {
+1 −1
Original line number Diff line number Diff line
@@ -157,7 +157,7 @@ static int write_public_keyfile(RSA *private_key, const char *private_key_path)
{
    RSAPublicKey pkey;
    FILE *outfile = NULL;
    char path[PATH_MAX], info[MAX_PAYLOAD];
    char path[PATH_MAX], info[MAX_PAYLOAD_V1];
    uint8_t* encoded = nullptr;
    size_t encoded_length;
    int ret = 0;
Loading