stream: Separate TCP/Unix stream helpers from stream/service implementations
This allows us to disable Unix sockets cleanly on Windows. Replaces some read/write calls with recv/send counterparts, as Winsock does not like read/writes.
This commit is contained in:
@@ -15,6 +15,13 @@
|
||||
|
||||
#include "stream_manager.h"
|
||||
|
||||
#include "stream_tcp.h"
|
||||
#include "stream_service_tcp.h"
|
||||
#ifndef WIN32
|
||||
# include "stream_unix.h"
|
||||
# include "stream_service_unix.h"
|
||||
#endif
|
||||
|
||||
#include <threading/rwlock.h>
|
||||
|
||||
typedef struct private_stream_manager_t private_stream_manager_t;
|
||||
@@ -193,10 +200,12 @@ METHOD(stream_manager_t, remove_service, void,
|
||||
METHOD(stream_manager_t, destroy, void,
|
||||
private_stream_manager_t *this)
|
||||
{
|
||||
remove_stream(this, stream_create_unix);
|
||||
remove_stream(this, stream_create_tcp);
|
||||
remove_service(this, stream_service_create_unix);
|
||||
remove_service(this, stream_service_create_tcp);
|
||||
#ifndef WIN32
|
||||
remove_stream(this, stream_create_unix);
|
||||
remove_service(this, stream_service_create_unix);
|
||||
#endif
|
||||
|
||||
this->streams->destroy(this->streams);
|
||||
this->services->destroy(this->services);
|
||||
@@ -226,10 +235,12 @@ stream_manager_t *stream_manager_create()
|
||||
.lock = rwlock_create(RWLOCK_TYPE_DEFAULT),
|
||||
);
|
||||
|
||||
add_stream(this, "unix://", stream_create_unix);
|
||||
add_stream(this, "tcp://", stream_create_tcp);
|
||||
add_service(this, "unix://", stream_service_create_unix);
|
||||
add_service(this, "tcp://", stream_service_create_tcp);
|
||||
#ifndef WIN32
|
||||
add_stream(this, "unix://", stream_create_unix);
|
||||
add_service(this, "unix://", stream_service_create_unix);
|
||||
#endif
|
||||
|
||||
return &this->public;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user