void Send(Matrix &): Method to send a Matrix to an address given by other_Addr.addr_in.
| 758 | // void Send(Matrix &): |
| 759 | // Method to send a Matrix to an address given by other_Addr.addr_in. |
| 760 | int |
| 761 | TCP_SocketSSL::sendMatrix(int dbTag, int commitTag, |
| 762 | const Matrix &theMatrix, ChannelAddress *theAddress) |
| 763 | { |
| 764 | // first check address is the only address a TCP_socket can send to |
| 765 | SocketAddress *theSocketAddress = 0; |
| 766 | if (theAddress != 0) { |
| 767 | if (theAddress->getType() == SOCKET_TYPE) |
| 768 | theSocketAddress = (SocketAddress *)theAddress; |
| 769 | else { |
| 770 | opserr << "TCP_SocketSSL::sendMatrix() - a TCP_SocketSSL "; |
| 771 | opserr << "can only communicate with a TCP_SocketSSL"; |
| 772 | opserr << " address given is not of type SocketAddress\n"; |
| 773 | return -1; |
| 774 | } SocketAddress *theSocketAddress = 0; |
| 775 | |
| 776 | if (memcmp((char *) &other_Addr.addr_in, (char *) &theSocketAddress->address.addr_in, |
| 777 | theSocketAddress->addrLength) != 0) { |
| 778 | |
| 779 | opserr << "TCP_SocketSSL::sendMatrix() - a TCP_SocketSSL "; |
| 780 | opserr << "can only communicate with one other TCP_SocketSSL\n"; |
| 781 | return -1; |
| 782 | } |
| 783 | } |
| 784 | |
| 785 | // if o.k. get a pointer to the data in the Matrix and |
| 786 | // place the incoming data there |
| 787 | int nleft; |
| 788 | double *data = theMatrix.data; |
| 789 | char *gMsg = (char *)data; |
| 790 | nleft = theMatrix.dataSize * sizeof(double); |
| 791 | |
| 792 | #ifndef _WIN32 |
| 793 | if (endiannessProblem) { |
| 794 | void *array = (void *)data; |
| 795 | byte_swap(array, theMatrix.dataSize, sizeof(double)); |
| 796 | } |
| 797 | #endif |
| 798 | |
| 799 | if (SSL_write(ssl, gMsg, nleft) != nleft) { |
| 800 | opserr << "TCP_SocketSSL::sendMatrix() - could not write data\n"; |
| 801 | SSL_shutdown(ssl); |
| 802 | SSL_free(ssl); |
| 803 | SSL_CTX_free(ctx); |
| 804 | cleanup_sockets(); |
| 805 | return -2; |
| 806 | } |
| 807 | |
| 808 | #ifndef _WIN32 |
| 809 | if (endiannessProblem) { |
| 810 | void *array = (void *)data; |
| 811 | byte_swap(array, theMatrix.dataSize, sizeof(double)); |
| 812 | } |
| 813 | #endif |
| 814 | |
| 815 | return 0; |
| 816 | } |
| 817 |
nothing calls this directly
no test coverage detected