diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/openssl/stream_peer_openssl.cpp | 7 | ||||
-rw-r--r-- | drivers/unix/dir_access_unix.cpp | 31 | ||||
-rw-r--r-- | drivers/unix/thread_posix.cpp | 7 | ||||
-rw-r--r-- | drivers/windows/dir_access_windows.cpp | 20 | ||||
-rw-r--r-- | drivers/windows/thread_windows.cpp | 9 | ||||
-rw-r--r-- | drivers/windows/thread_windows.h | 1 |
6 files changed, 50 insertions, 25 deletions
diff --git a/drivers/openssl/stream_peer_openssl.cpp b/drivers/openssl/stream_peer_openssl.cpp index 67f58b6028..9349df3793 100644 --- a/drivers/openssl/stream_peer_openssl.cpp +++ b/drivers/openssl/stream_peer_openssl.cpp @@ -309,6 +309,9 @@ Error StreamPeerOpenSSL::connect(Ref<StreamPeer> p_base, bool p_validate_certs, validate_certs=p_validate_certs; validate_hostname=p_for_hostname!=""; + + + if (p_validate_certs) { @@ -380,6 +383,10 @@ Error StreamPeerOpenSSL::connect(Ref<StreamPeer> p_base, bool p_validate_certs, bio->ptr = this; SSL_set_bio( ssl, bio, bio ); + if (p_for_hostname!=String()) { + SSL_set_tlsext_host_name(ssl,p_for_hostname.utf8().get_data()); + } + use_blocking=true; // let handshake use blocking // Set the SSL to automatically retry on failure. SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY); diff --git a/drivers/unix/dir_access_unix.cpp b/drivers/unix/dir_access_unix.cpp index f0e4511b1d..544d3883dc 100644 --- a/drivers/unix/dir_access_unix.cpp +++ b/drivers/unix/dir_access_unix.cpp @@ -67,8 +67,8 @@ bool DirAccessUnix::file_exists(String p_file) { if (p_file.is_rel_path()) p_file=current_dir.plus_file(p_file); - else - p_file=fix_path(p_file); + + p_file=fix_path(p_file); struct stat flags; bool success = (stat(p_file.utf8().get_data(),&flags)==0); @@ -88,8 +88,8 @@ bool DirAccessUnix::dir_exists(String p_dir) { if (p_dir.is_rel_path()) p_dir=get_current_dir().plus_file(p_dir); - else - p_dir=fix_path(p_dir); + + p_dir=fix_path(p_dir); struct stat flags; bool success = (stat(p_dir.utf8().get_data(),&flags)==0); @@ -105,8 +105,8 @@ uint64_t DirAccessUnix::get_modified_time(String p_file) { if (p_file.is_rel_path()) p_file=current_dir.plus_file(p_file); - else - p_file=fix_path(p_file); + + p_file=fix_path(p_file); struct stat flags; bool success = (stat(p_file.utf8().get_data(),&flags)==0); @@ -201,8 +201,11 @@ Error DirAccessUnix::make_dir(String p_dir) { if (p_dir.is_rel_path()) p_dir=get_current_dir().plus_file(p_dir); - else - p_dir=fix_path(p_dir); + + + p_dir=fix_path(p_dir); + + #if 1 @@ -287,13 +290,13 @@ Error DirAccessUnix::rename(String p_path,String p_new_path) { if (p_path.is_rel_path()) p_path=get_current_dir().plus_file(p_path); - else - p_path=fix_path(p_path); + + p_path=fix_path(p_path); if (p_new_path.is_rel_path()) p_new_path=get_current_dir().plus_file(p_new_path); - else - p_new_path=fix_path(p_new_path); + + p_new_path=fix_path(p_new_path); return ::rename(p_path.utf8().get_data(),p_new_path.utf8().get_data())==0?OK:FAILED; } @@ -301,8 +304,8 @@ Error DirAccessUnix::remove(String p_path) { if (p_path.is_rel_path()) p_path=get_current_dir().plus_file(p_path); - else - p_path=fix_path(p_path); + + p_path=fix_path(p_path); struct stat flags; if ((stat(p_path.utf8().get_data(),&flags)!=0)) diff --git a/drivers/unix/thread_posix.cpp b/drivers/unix/thread_posix.cpp index 6ace64a923..c71e09685b 100644 --- a/drivers/unix/thread_posix.cpp +++ b/drivers/unix/thread_posix.cpp @@ -27,6 +27,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "thread_posix.h" +#include "script_language.h" #if defined(UNIX_ENABLED) || defined(PTHREAD_ENABLED) @@ -50,7 +51,13 @@ void *ThreadPosix::thread_callback(void *userdata) { ThreadPosix *t=reinterpret_cast<ThreadPosix*>(userdata); t->id=(ID)pthread_self(); + + ScriptServer::thread_enter(); //scripts may need to attach a stack + t->callback(t->user); + + ScriptServer::thread_exit(); + return NULL; } diff --git a/drivers/windows/dir_access_windows.cpp b/drivers/windows/dir_access_windows.cpp index fa18f7c1f5..90e43d2518 100644 --- a/drivers/windows/dir_access_windows.cpp +++ b/drivers/windows/dir_access_windows.cpp @@ -193,8 +193,8 @@ Error DirAccessWindows::make_dir(String p_dir) { if (p_dir.is_rel_path()) p_dir=get_current_dir().plus_file(p_dir); - else - p_dir=fix_path(p_dir); + + p_dir=fix_path(p_dir); p_dir = p_dir.replace("/","\\"); bool success; @@ -268,8 +268,8 @@ bool DirAccessWindows::dir_exists(String p_dir) { if (p_dir.is_rel_path()) p_dir=get_current_dir().plus_file(p_dir); - else - p_dir=fix_path(p_dir); + + p_dir=fix_path(p_dir); //p_dir.replace("/","\\"); @@ -289,13 +289,13 @@ Error DirAccessWindows::rename(String p_path,String p_new_path) { if (p_path.is_rel_path()) p_path=get_current_dir().plus_file(p_path); - else - p_path=fix_path(p_path); + + p_path=fix_path(p_path); if (p_new_path.is_rel_path()) p_new_path=get_current_dir().plus_file(p_new_path); - else - p_new_path=fix_path(p_new_path); + + p_new_path=fix_path(p_new_path); if (file_exists(p_new_path)) { if (remove(p_new_path) != OK) { @@ -310,8 +310,8 @@ Error DirAccessWindows::remove(String p_path) { if (p_path.is_rel_path()) p_path=get_current_dir().plus_file(p_path); - else - p_path=fix_path(p_path); + + p_path=fix_path(p_path); printf("erasing %s\n",p_path.utf8().get_data()); diff --git a/drivers/windows/thread_windows.cpp b/drivers/windows/thread_windows.cpp index d5e489aab4..884575e81e 100644 --- a/drivers/windows/thread_windows.cpp +++ b/drivers/windows/thread_windows.cpp @@ -32,6 +32,7 @@ #include "os/memory.h" + Thread::ID ThreadWindows::get_ID() const { return id; @@ -45,8 +46,14 @@ Thread* ThreadWindows::create_thread_windows() { DWORD ThreadWindows::thread_callback( LPVOID userdata ) { ThreadWindows *t=reinterpret_cast<ThreadWindows*>(userdata); - t->callback(t->user); + + ScriptServer::thread_enter(); //scripts may need to attach a stack + t->id=(ID)GetCurrentThreadId(); // must implement + t->callback(t->user); + + ScriptServer::thread_exit(); + return 0; } diff --git a/drivers/windows/thread_windows.h b/drivers/windows/thread_windows.h index b051bfe370..1c90504dde 100644 --- a/drivers/windows/thread_windows.h +++ b/drivers/windows/thread_windows.h @@ -36,6 +36,7 @@ #ifdef WINDOWS_ENABLED #include "os/thread.h" +#include "script_language.h" #include <windows.h> class ThreadWindows : public Thread { |