#include "frontends/Application.h"
#include "support/environment.h"
+#include "support/filename.h"
#include "support/lyxlib.h"
#include "support/socktools.h"
// Needed by lyxclient
support::setEnv("LYXSOCKET", address_);
- theApp->registerSocketCallback(
+ theApp()->registerSocketCallback(
fd_,
boost::bind(&LyXServerSocket::serverCallback, this)
);
LyXServerSocket::~LyXServerSocket()
{
if (fd_ != -1) {
- theApp->unregisterSocketCallback(fd_);
- if (close(fd_) != 0)
+ BOOST_ASSERT (theApp());
+ theApp()->unregisterSocketCallback(fd_);
+ if (::close(fd_) != 0)
lyxerr << "lyx: Server socket " << fd_
<< " IO error on closing: " << strerror(errno);
}
- support::unlink(address_);
+ support::unlink(support::FileName(address_));
lyxerr[Debug::LYXSERVER] << "lyx: Server socket quitting" << endl;
}
// Register the new client.
clients[client_fd] =
shared_ptr<LyXDataSocket>(new LyXDataSocket(client_fd));
- theApp->registerSocketCallback(
+ theApp()->registerSocketCallback(
client_fd,
boost::bind(&LyXServerSocket::dataCallback,
this, client_fd)
{
string const linen(line + '\n');
int const size = linen.size();
- int const written = write(fd_, linen.c_str(), size);
+ int const written = ::write(fd_, linen.c_str(), size);
if (written < size) { // Always mean end of connection.
if ((written == -1) && (errno == EPIPE)) {
// The program will also receive a SIGPIPE
LyXDataSocket::~LyXDataSocket()
{
- if (close(fd_) != 0)
+ if (::close(fd_) != 0)
lyxerr << "lyx: Data socket " << fd_
<< " IO error on closing: " << strerror(errno);
- theApp->unregisterSocketCallback(fd_);
+ theApp()->unregisterSocketCallback(fd_);
lyxerr[Debug::LYXSERVER] << "lyx: Data socket " << fd_ << " quitting."
<< endl;
}
int count;
// read and store characters in buffer
- while ((count = read(fd_, charbuf, charbuf_size - 1)) > 0) {
+ while ((count = ::read(fd_, charbuf, charbuf_size - 1)) > 0) {
buffer_.append(charbuf, charbuf + count);
}
{
string const linen(line + '\n');
int const size = linen.size();
- int const written = write(fd_, linen.c_str(), size);
+ int const written = ::write(fd_, linen.c_str(), size);
if (written < size) { // Always mean end of connection.
if ((written == -1) && (errno == EPIPE)) {
// The program will also receive a SIGPIPE