Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 1997 - 2001 Pekka Riikonen
+ Copyright (C) 1997 - 2005 Pekka Riikonen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
SOCKET fd = sock->sock;
SilcBuffer src = sock->outbuf;
+ if (!src)
+ return -2;
if (SILC_IS_DISABLED(sock))
return -1;
return -2;
}
SILC_LOG_ERROR(("Cannot write to socket: %d", (int)fd));
+ sock->sock_error = err;
return -1;
}
+ if (ret < src->len) {
+ SILC_LOG_DEBUG(("Wrote data %d of %d bytes, will write rest later",
+ ret, src->len));
+ silc_buffer_pull(src, ret);
+ return -2;
+ }
+
silc_buffer_pull(src, ret);
}
return -2;
}
SILC_LOG_ERROR(("Cannot read from socket: %d", (int)fd));
+ sock->sock_error = err;
return -1;
}
return len;
}
+
+/* Returns human readable socket error message */
+
+bool silc_socket_get_error(SilcSocketConnection sock, char *error,
+ SilcUInt32 error_len)
+{
+ /* XXX TODO */
+ return FALSE;
+}