1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-29 05:21:37 +03:00

got rid of a write system call

git-svn-id: svn://svn.code.sf.net/p/axtls/code/trunk@39 9a5d90b5-6617-0410-8a86-bb477d3ed2e3
This commit is contained in:
cameronrich
2006-11-19 00:32:10 +00:00
parent 3eaa68bfda
commit 73c11ecadb
6 changed files with 24 additions and 23 deletions

View File

@ -902,7 +902,8 @@ static void *crypt_new(SSL *ssl, uint8_t *key, uint8_t *iv, int is_decrypt)
*/
static int send_raw_packet(SSL *ssl, uint8_t protocol)
{
uint8_t rec_buf[SSL_RECORD_SIZE];
uint8_t *rec_buf = ssl->bm_buf.pre_data;
int pkt_size = SSL_RECORD_SIZE+ssl->bm_buf.index;
int ret;
rec_buf[0] = protocol;
@ -911,17 +912,10 @@ static int send_raw_packet(SSL *ssl, uint8_t protocol)
rec_buf[3] = ssl->bm_buf.index >> 8;
rec_buf[4] = ssl->bm_buf.index & 0xff;
DISPLAY_BYTES(ssl, "sending %d bytes", rec_buf, 5, 5);
DISPLAY_BYTES(ssl, "sending %d bytes", ssl->bm_buf.data,
ssl->bm_buf.index, ssl->bm_buf.index);
DISPLAY_BYTES(ssl, "sending %d bytes", ssl->bm_buf.pre_data,
pkt_size, pkt_size);
/* 2 system calls, but what the hell it makes life a lot simpler */
ret = SOCKET_WRITE(ssl->client_fd, rec_buf, SSL_RECORD_SIZE);
if (ret > 0)
{
ret = SOCKET_WRITE(ssl->client_fd, ssl->bm_buf.data, ssl->bm_buf.index);
}
ret = SOCKET_WRITE(ssl->client_fd, ssl->bm_buf.pre_data, pkt_size);
SET_SSL_FLAG(SSL_NEED_RECORD); /* reset for next time */
ssl->bm_buf.index = 0;