Skip to content
Snippets Groups Projects
Commit 4edb8df3 authored by Martin Stjernholm's avatar Martin Stjernholm
Browse files

Initialize accepted connections to blocking mode.

Rev: lib/modules/Remote.pmod/Server.pike:1.10
parent 46394029
No related branches found
No related tags found
No related merge requests found
...@@ -39,6 +39,7 @@ class Minicontext ...@@ -39,6 +39,7 @@ class Minicontext
void got_connection(object f) void got_connection(object f)
{ {
object c = f->accept(); object c = f->accept();
c->set_blocking();
object con = Connection(0, max_call_threads); object con = Connection(0, max_call_threads);
object ctx = Context(gethostname()+"-"+portno); object ctx = Context(gethostname()+"-"+portno);
if (!c) if (!c)
...@@ -62,6 +63,8 @@ void create(string host, int p, void|int _max_call_threads) ...@@ -62,6 +63,8 @@ void create(string host, int p, void|int _max_call_threads)
else if(!port->bind(p, got_connection, host)) else if(!port->bind(p, got_connection, host))
throw(({"Failed to bind to port\n", backtrace()})); throw(({"Failed to bind to port\n", backtrace()}));
DEBUGMSG("listening to " + host + ":" + p + "\n");
if(!portno) if(!portno)
sscanf(port->query_address(), "%*s %d", portno); sscanf(port->query_address(), "%*s %d", portno);
...@@ -76,11 +79,13 @@ void provide(string name, mixed thing) ...@@ -76,11 +79,13 @@ void provide(string name, mixed thing)
void close() void close()
{ {
DEBUGMSG("closing listening port\n");
destruct (port); destruct (port);
} }
void close_all() void close_all()
{ {
DEBUGMSG("closing listening port and all connections\n");
destruct (port); destruct (port);
foreach (connections, object conn) conn->close(); foreach (connections, object conn) conn->close();
} }
...@@ -92,5 +97,6 @@ int closed() ...@@ -92,5 +97,6 @@ int closed()
void destroy() void destroy()
{ {
DEBUGMSG("destruct" + (port ? " - closing listening port\n" : "\n"));
catch (destruct (port)); catch (destruct (port));
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment