X-Git-Url: http://p2p-next.cs.pub.ro/gitweb/?a=blobdiff_plain;f=src%2Flibswift%2Fchannel.cpp;h=ef30addc05e2e26852b61b6daa24fd9c8e01c294;hb=45ee60cc6bc8ba52c1dbc4784cf61291a90c97f9;hp=4fed7a5d7cbb6bbcb6ab99c2b07e496dd70e51cd;hpb=722d42608bfc8f90d258ecd9c2e6a591c47602fa;p=swifty.git diff --git a/src/libswift/channel.cpp b/src/libswift/channel.cpp index 4fed7a5..ef30add 100644 --- a/src/libswift/channel.cpp +++ b/src/libswift/channel.cpp @@ -281,8 +281,8 @@ int Channel::SendTo (evutil_socket_t sock, const Address& addr, struct evbuffer } int Channel::RecvFrom (evutil_socket_t sock, Address& addr, struct evbuffer **evb) { - socklen_t addrlen = sizeof(struct sockaddr_mptp) + addr.addr->count * sizeof(mptp_dest); int count = addr.addr->count; + socklen_t addrlen = sizeof(struct sockaddr_mptp) + count * sizeof(mptp_dest); struct evbuffer_iovec vec[count]; for (int i=0; icount; + msg.msg_iovlen = count; msg.msg_name = addr.addr; msg.msg_namelen = addrlen; int length = recvmsg(sock, &msg, 0); @@ -321,14 +321,16 @@ int Channel::RecvFrom (evutil_socket_t sock, Address& addr, struct evbuffer **ev else print_error("error on recv"); } + length = 0; for (int i=0; icount; ++i) { - vec[i].iov_len = iov[i].iov_len; + length += addr.addr->dests[i].bytes; + vec[i].iov_len = addr.addr->dests[i].bytes; if (evbuffer_commit_space(evb[i], &vec[i], 1) < 0) { length = 0; print_error("error on evbuffer_commit_space"); } } - global_dgrams_down++; + global_dgrams_down+=addr.addr->count; global_raw_bytes_down+=length; Time(); return length;