Commit 0f6edf77 authored by Greg Williams's avatar Greg Williams
Browse files

Added a clean fix candidate for validating ISE with, and removed temp debug info

parent f0d50ba9
Loading
Loading
Loading
Loading
+4 −24
Original line number Diff line number Diff line
@@ -777,36 +777,16 @@ static ssize_t socket_write_ssl(sender *s, tx_info_t *info, SSL *ssl) {
    boxed_msg *box = info->u.write.box;
    uint8_t *msg = box->out_msg;
    size_t msg_size = box->out_msg_size;
    size_t sent_size = info->u.write.sent_size;
    size_t rem = msg_size - sent_size;
    size_t rem = msg_size - info->u.write.sent_size;
    int fd = info->u.write.fd;
    ssize_t written = 0;
    for (;;) {
        BUS_LOG_SNPRINTF(b, 3, LOG_SENDER, b->udata, 64,
            "SSL write %p to %d, %zd bytes (info %d)",
            (void*)&msg[sent_size], fd, rem, info->id);

    while (rem > 0) {
        ssize_t wrsz = SSL_write(ssl, &msg[info->u.write.sent_size], rem);

        BUS_LOG_SNPRINTF(b, 3, LOG_SENDER, b->udata, 64,
            "SSL wrote %zd bytes to %d (info %d)",
            wrsz, fd, info->id);

        if (wrsz > 0) {
            update_sent(b, s, info, wrsz);

            written += wrsz;
            size_t rem = msg_size - written;
            
            BUS_LOG_SNPRINTF(b, 3, LOG_SENDER, b->udata, 128,
                "SSL has sent %zd w/ %zd bytes remaining to send to %d (info %d)",
                written, rem, fd, info->id);

            if (rem == 0) {
                BUS_LOG_SNPRINTF(b, 3, LOG_SENDER, b->udata, 128,
                    "SSL has sent all data for current packet! (%zd bytes)", written);
                break;
            }
            rem -= wrsz;
        } else if (wrsz < 0) {
            int reason = SSL_get_error(ssl, wrsz);
            switch (reason) {
@@ -855,7 +835,7 @@ static void update_sent(struct bus *b, sender *s, tx_info_t *info, ssize_t sent)
    size_t rem = msg_size - info->u.write.sent_size;
    
    BUS_LOG_SNPRINTF(b, 5, LOG_SENDER, b->udata, 64,
        "wrote %zd, msg_size %zu (%p)",
        "wrote %zd, msg_size %zd (%p)",
        sent, msg_size, (void*)box->out_msg);
    if (rem == 0) { /* completed! */
        fd_info *fdi = info->u.write.fdi;
+5 −3
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ static const char strKey[] = "GET system test blob";

void setUp(void)
{ LOG_LOCATION;
    SystemTestSetup(&Fixture, 5);
    SystemTestSetup(&Fixture, 3);

    KeyBuffer = ByteBuffer_CreateAndAppendCString(KeyData, sizeof(KeyData), strKey);
    ExpectedKeyBuffer = ByteBuffer_CreateAndAppendCString(ExpectedKeyData, sizeof(ExpectedKeyData), strKey);
@@ -66,9 +66,11 @@ void tearDown(void)

void test_InstantSecureErase_should_erase_device_contents(void)
{ LOG_LOCATION;
    for(int i = 0; i < 10; i++) {
        KineticStatus status = KineticAdminClient_InstantSecureErase(&Fixture.adminSession);
        TEST_ASSERT_EQUAL_KineticStatus(KINETIC_STATUS_SUCCESS, status);
    }
}

/*******************************************************************************
* ENSURE THIS IS AFTER ALL TESTS IN THE TEST SUITE