| 817 | |
| 818 | |
| 819 | int |
| 820 | TCP_SocketSSL::recvVector(int dbTag, int commitTag, |
| 821 | Vector &theVector, ChannelAddress *theAddress) |
| 822 | { |
| 823 | // first check address is the only address a TCP_socket can send to |
| 824 | SocketAddress *theSocketAddress = 0; |
| 825 | if (theAddress != 0) { |
| 826 | if (theAddress->getType() == SOCKET_TYPE) |
| 827 | theSocketAddress = (SocketAddress *)theAddress; |
| 828 | else { |
| 829 | opserr << "TCP_SocketSSL::recvVector() - a TCP_SocketSSL "; |
| 830 | opserr << "can only communicate with a TCP_SocketSSL"; |
| 831 | opserr << " address given is not of type SocketAddress\n"; |
| 832 | return -1; |
| 833 | } |
| 834 | if (memcmp((char *) &other_Addr.addr_in, (char *) &theSocketAddress->address.addr_in, |
| 835 | theSocketAddress->addrLength) != 0) { |
| 836 | |
| 837 | opserr << "TCP_SocketSSL::recvVector() - a TCP_SocketSSL "; |
| 838 | opserr << "can only communicate with one other TCP_SocketSSL\n"; |
| 839 | return -1; |
| 840 | } |
| 841 | } |
| 842 | |
| 843 | // if o.k. get a pointer to the data in the Vector and |
| 844 | // place the incoming data there |
| 845 | int nleft, nread; |
| 846 | double *data = theVector.theData; |
| 847 | char *gMsg = (char *)data;; |
| 848 | nleft = theVector.sz * sizeof(double); |
| 849 | |
| 850 | while (nleft > 0) { |
| 851 | nread = SSL_read(ssl, gMsg, nleft); |
| 852 | if (nread < 0) { |
| 853 | opserr << "TCP_SocketSSL::recvVector() - could not read data\n"; |
| 854 | SSL_shutdown(ssl); |
| 855 | SSL_free(ssl); |
| 856 | SSL_CTX_free(ctx); |
| 857 | cleanup_sockets(); |
| 858 | return -2; |
| 859 | } |
| 860 | nleft -= nread; |
| 861 | gMsg += nread; |
| 862 | } |
| 863 | |
| 864 | #ifndef _WIN32 |
| 865 | if (endiannessProblem) { |
| 866 | void *array = (void *)data; |
| 867 | byte_swap(array, theVector.sz, sizeof(double)); |
| 868 | } |
| 869 | #endif |
| 870 | |
| 871 | return 0; |
| 872 | } |
| 873 | |
| 874 | |
| 875 | // void Send(Vector &): |
nothing calls this directly
no test coverage detected