LuaSec 0.3.2

This commit is contained in:
Bruno Silvestre 2012-09-02 11:30:04 -03:00
parent affd08cf05
commit d28c5e4f9e
11 changed files with 33 additions and 14 deletions

View File

@ -1,3 +1,9 @@
--------------------------------------------------------------------------------
LuaSec 0.3.2
------------
- BUG: Windows uses a different way to report socket error.
(thanks Sebastien Perin)
--------------------------------------------------------------------------------
LuaSec 0.3.1
------------

View File

@ -1,4 +1,4 @@
LuaSec 0.3.1
LuaSec 0.3.2
------------
* On Linux, BSD, and Mac OS X:

View File

@ -1,4 +1,4 @@
LuaSec 0.3.1 license
LuaSec 0.3.2 license
Copyright (C) 2006-2009 Bruno Silvestre
Permission is hereby granted, free of charge, to any person obtaining

View File

@ -1,5 +1,5 @@
/*--------------------------------------------------------------------------
* LuaSec 0.3.1
* LuaSec 0.3.2
* Copyright (C) 2006-2009 Bruno Silvestre
*
*--------------------------------------------------------------------------*/

View File

@ -2,7 +2,7 @@
#define __CONTEXT_H__
/*--------------------------------------------------------------------------
* LuaSec 0.3.1
* LuaSec 0.3.2
* Copyright (C) 2006-2009 Bruno Silvestre
*
*--------------------------------------------------------------------------*/

View File

@ -43,5 +43,6 @@ void socket_setnonblocking(p_socket ps);
void socket_setblocking(p_socket ps);
int socket_waitfd(p_socket ps, int sw, p_timeout tm);
const char *socket_strerror(int err);
int socket_error();
#endif /* SOCKET_H */

View File

@ -1,10 +1,9 @@
/*--------------------------------------------------------------------------
* LuaSec 0.3.1
* LuaSec 0.3.2
* Copyright (C) 2006-2009 Bruno Silvestre
*
*--------------------------------------------------------------------------*/
#include <errno.h>
#include <string.h>
#include <openssl/ssl.h>
@ -91,7 +90,7 @@ static int handshake(p_ssl ssl)
}
if (err == 0)
return IO_CLOSED;
return errno;
return socket_error();
default:
return IO_SSL;
}
@ -133,7 +132,7 @@ static int ssl_send(void *ctx, const char *data, size_t count, size_t *sent,
}
if (err == 0)
return IO_CLOSED;
return errno;
return socket_error();
default:
return IO_SSL;
}
@ -178,7 +177,7 @@ static int ssl_recv(void *ctx, char *data, size_t count, size_t *got,
}
if (err == 0)
return IO_CLOSED;
return errno;
return socket_error();
default:
return IO_SSL;
}

View File

@ -2,7 +2,7 @@
#define __SSL_H__
/*--------------------------------------------------------------------------
* LuaSec 0.3.1
* LuaSec 0.3.2
* Copyright (C) 2006-2009 Bruno Silvestre
*
*--------------------------------------------------------------------------*/

View File

@ -1,5 +1,5 @@
------------------------------------------------------------------------------
-- LuaSec 0.3.1
-- LuaSec 0.3.2
-- Copyright (C) 2006-2008 Bruno Silvestre
--
------------------------------------------------------------------------------
@ -10,8 +10,8 @@ require("ssl.core")
require("ssl.context")
_VERSION = "0.3.1"
_COPYRIGHT = "LuaSec 0.3.1 - Copyright (C) 2006-2009 Bruno Silvestre\n" ..
_VERSION = "0.3.2"
_COPYRIGHT = "LuaSec 0.3.2 - Copyright (C) 2006-2009 Bruno Silvestre\n" ..
"LuaSocket 2.0.2 - Copyright (C) 2004-2007 Diego Nehab"
-- Export functions

View File

@ -135,3 +135,11 @@ const char *socket_strerror(int err) {
}
}
/*-------------------------------------------------------------------------*\
* Underline error code.
\*-------------------------------------------------------------------------*/
int socket_error()
{
return errno;
}

View File

@ -150,7 +150,6 @@ static const char *wstrerror(int err) {
const char *socket_strerror(int err) {
if (err <= 0) return io_strerror(err);
switch (err) {
case ERROR_FILE_NOT_FOUND: return "closed";
case WSAEADDRINUSE: return "address already in use";
case WSAECONNREFUSED: return "connection refused";
case WSAEISCONN: return "already connected";
@ -162,3 +161,9 @@ const char *socket_strerror(int err) {
}
}
/* Socket error code */
int socket_error()
{
return WSAGetLastError();
}