MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / packet_send

Function packet_send

src/remote/inet.cpp:3145–3290  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3143
3144
3145static bool packet_send( rem_port* port, const SCHAR* buffer, SSHORT buffer_length)
3146{
3147/**************************************
3148 *
3149 * p a c k e t _ s e n d
3150 *
3151 **************************************
3152 *
3153 * Functional description
3154 * Send some data on it's way.
3155 *
3156 **************************************/
3157
3158 SSHORT length = buffer_length;
3159 const char* data = buffer;
3160
3161 // encrypt
3162 HalfStaticArray<char, BUFFER_TINY> b;
3163 if (port->port_crypt_plugin && port->port_crypt_complete)
3164 {
3165 LocalStatus ls;
3166 CheckStatusWrapper st(&ls);
3167
3168 char* d = b.getBuffer(buffer_length);
3169 port->port_crypt_plugin->encrypt(&st, buffer_length, data, d);
3170 if (st.getState() & IStatus::STATE_ERRORS)
3171 {
3172 status_exception::raise(&st);
3173 }
3174
3175 data = d;
3176 }
3177
3178 while (length)
3179 {
3180#ifdef DEBUG
3181 if (INET_trace & TRACE_operations)
3182 {
3183 fprintf(stdout, "Before Send\n");
3184 fflush(stdout);
3185 }
3186#endif
3187 SSHORT n = send(port->port_handle, data, length, FB_SEND_FLAGS);
3188#if COMPRESS_DEBUG > 1
3189 fprintf(stderr, "send(%d, %p, %d, FB_SEND_FLAGS) == %d\n", port->port_handle, data, length, n);
3190#endif
3191#ifdef DEBUG
3192 if (INET_trace & TRACE_operations)
3193 {
3194 fprintf(stdout, "After Send n is %d\n", n);
3195 fflush(stdout);
3196 }
3197#endif
3198 if (n == length) {
3199 break;
3200 }
3201
3202 if (n == -1)

Callers 3

packet_receive2Function · 0.85
inet_writeFunction · 0.85
REMOTE_deflateFunction · 0.85

Calls 9

raiseFunction · 0.85
fflushFunction · 0.85
inet_errorFunction · 0.85
pauseClass · 0.85
sigactionClass · 0.70
sleepFunction · 0.50
getBufferMethod · 0.45
encryptMethod · 0.45
getStateMethod · 0.45

Tested by

no test coverage detected