X-Git-Url: http://p2p-next.cs.pub.ro/gitweb/?a=blobdiff_plain;f=src%2Flibswift%2Fchannel.cpp;h=e06d83ff52803ee5770834ce5c72a1e7d85a3474;hb=da188550ca4b16d1f49b0e59938ff93612a6cdbb;hp=ef30addc05e2e26852b61b6daa24fd9c8e01c294;hpb=0878db5a25f39a1f63710c333301ea1ccfd5cc68;p=swifty.git diff --git a/src/libswift/channel.cpp b/src/libswift/channel.cpp index ef30add..e06d83f 100644 --- a/src/libswift/channel.cpp +++ b/src/libswift/channel.cpp @@ -253,29 +253,36 @@ Address swift::BoundAddress(evutil_socket_t sock) { } -int Channel::SendTo (evutil_socket_t sock, const Address& addr, struct evbuffer *evb) { +int Channel::SendTo (evutil_socket_t sock, const Address& addr, struct evbuffer **evb) { - int length = evbuffer_get_length(evb); - int addr_len = sizeof(struct sockaddr_mptp) + addr.addr->count * sizeof(struct mptp_dest); - struct iovec iov[1]; + int count = addr.addr->count; + int addr_len = sizeof(struct sockaddr_mptp) + count * sizeof(struct mptp_dest); + struct iovec iov[count]; + int lengths[count]; struct msghdr msg; memset(&msg, 0, sizeof(msg)); memset(&iov, 0, sizeof(iov)); - iov[0].iov_base = evbuffer_pullup(evb, length); - iov[0].iov_len = length; + for (int i=0; idests[i].bytes); + global_dgrams_up+=count; + for (int i=0; i