comparison libfdcore/sctp.c @ 1102:1d7b3ebda27f

Implemented the calls to HOOK_DATA_RECEIVED hook
author Sebastien Decugis <sdecugis@freediameter.net>
date Thu, 09 May 2013 16:40:02 +0800
parents 74bba7975864
children 96f2051215c8
comparison
equal deleted inserted replaced
1101:40b48a3997a2 1102:1d7b3ebda27f
1083 mhdr.msg_control = &ancidata; 1083 mhdr.msg_control = &ancidata;
1084 mhdr.msg_controllen = sizeof(ancidata); 1084 mhdr.msg_controllen = sizeof(ancidata);
1085 1085
1086 /* We will loop while all data is not received. */ 1086 /* We will loop while all data is not received. */
1087 incomplete: 1087 incomplete:
1088 while (datasize + sizeof(struct timespec) >= bufsz ) { 1088 while (datasize >= bufsz ) {
1089 /* The buffer is full, enlarge it */ 1089 /* The buffer is full, enlarge it */
1090 bufsz += mempagesz; 1090 bufsz += mempagesz;
1091 CHECK_MALLOC( data = realloc(data, bufsz ) ); 1091 CHECK_MALLOC( data = realloc(data, bufsz ) );
1092 } 1092 }
1093 /* the new data will be received following the preceding */ 1093 /* the new data will be received following the preceding */
1094 memset(&iov, 0, sizeof(iov)); 1094 memset(&iov, 0, sizeof(iov));
1095 iov.iov_base = data + datasize ; 1095 iov.iov_base = data + datasize ;
1096 iov.iov_len = bufsz - sizeof(struct timespec) - datasize; 1096 iov.iov_len = bufsz - datasize;
1097 1097
1098 /* Receive data from the socket */ 1098 /* Receive data from the socket */
1099 again: 1099 again:
1100 pthread_cleanup_push(free, data); 1100 pthread_cleanup_push(free, data);
1101 ret = recvmsg(conn->cc_socket, &mhdr, 0); 1101 ret = recvmsg(conn->cc_socket, &mhdr, 0);
"Welcome to our mercurial repository"