Patch description:
Implement resuming tls sending in the outer function to avoid a
compiling warning.
BTW, I did this because the maxinum size of one gnutls record isn't big
enough for transfer the crm.dtd
Attached the patch.
It's depending on the last patch I've posted.
Thanks !
--
Yan Gao
China R&D Software Engineer
[EMAIL PROTECTED]
Novell, Inc.
SUSEĀ® Linux Enterprise 10
Your Linux is ready
http://www.novell.com/linux
# HG changeset patch
# User Yan Gao <[EMAIL PROTECTED]>
# Date 1200123802 -28800
# Node ID d4161ba59e07065f2dc99086e1505c6bcff6dc61
# Parent 148f9eb8da2c57cd2901500ee9ce2d8e99023ecd
mgmt: Resume tls sending in outer function
diff -r 148f9eb8da2c -r d4161ba59e07 lib/mgmt/mgmt_client_lib.c
--- a/lib/mgmt/mgmt_client_lib.c Fri Jan 11 14:56:20 2008 +0800
+++ b/lib/mgmt/mgmt_client_lib.c Sat Jan 12 15:43:22 2008 +0800
@@ -163,7 +163,7 @@ int
int
mgmt_session_sendmsg(void* session, const char* msg)
{
- int len;
+ int len, ret, count = 0;
if (session == NULL) {
return -1;
}
@@ -172,8 +172,14 @@ mgmt_session_sendmsg(void* session, cons
if (len == MAX_MSGLEN + 1) {
return -2;
}
- if (len != tls_send(session, msg, len)) {
- return -1;
+ while (count < len) {
+ ret = tls_send(session, msg + count, len - count) ;
+ if (ret < 0) {
+ return -1;
+ }
+ else {
+ count += ret;
+ }
}
/* get the bytes sent */
return len;
diff -r 148f9eb8da2c -r d4161ba59e07 lib/mgmt/mgmt_tls_lib.c
--- a/lib/mgmt/mgmt_tls_lib.c Fri Jan 11 14:56:20 2008 +0800
+++ b/lib/mgmt/mgmt_tls_lib.c Sat Jan 12 15:43:22 2008 +0800
@@ -76,18 +76,13 @@ ssize_t
ssize_t
tls_send(void* s, const void *buf, size_t len)
{
- int ret, count = 0;
gnutls_session* session = (gnutls_session*)s;
- while (count < len){
- while (1) {
- ret = gnutls_record_send(*session, buf + count, len - count);
- if (ret != GNUTLS_E_INTERRUPTED && ret != GNUTLS_E_AGAIN) {
- break;
- }
- }
- count += ret;
+ while (1) {
+ int ret = gnutls_record_send(*session, buf, len);
+ if (ret != GNUTLS_E_INTERRUPTED && ret != GNUTLS_E_AGAIN) {
+ return ret;
+ }
}
- return count;
}
ssize_t
tls_recv(void* s, void* buf, size_t len)
_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/