diff options
author | lloyd <[email protected]> | 2011-12-28 18:14:09 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2011-12-28 18:14:09 +0000 |
commit | 29033dac5b201c486048a6cfc75d72296caa0a92 (patch) | |
tree | 7413ef03255c0594f7d617ee590eac3bdc2714a9 /doc | |
parent | 965275b1d8457a9829a474821c2623a045213e53 (diff) |
Don't stall on error
Diffstat (limited to 'doc')
-rw-r--r-- | doc/examples/tls_client.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/doc/examples/tls_client.cpp b/doc/examples/tls_client.cpp index ad693c367..b44dbf7d5 100644 --- a/doc/examples/tls_client.cpp +++ b/doc/examples/tls_client.cpp @@ -49,6 +49,9 @@ class HTTPS_Client desired = client.received_data(&socket_buf[0], socket_got); socket_buf.resize(desired || 1); //printf("Going around for another read?\n"); + + if(quit_reading) + break; } } @@ -60,11 +63,11 @@ class HTTPS_Client void proc_data(const byte data[], size_t data_len, u16bit alert_info) { - printf("Block of data %d bytes alert %04X\n", (int)data_len, alert_info); + printf("Block of data %d bytes alert %d\n", (int)data_len, alert_info); for(size_t i = 0; i != data_len; ++i) printf("%c", data[i]); - if(data_len == 0 && alert_info == 0) + if(alert_info != 255) quit_reading = true; } @@ -75,7 +78,7 @@ class HTTPS_Client void read_response() { - while(true) + while(!quit_reading) { SecureVector<byte> buf(4096); |