mirror of
https://github.com/FelixKratz/SketchyBar
synced 2024-11-10 05:44:16 +00:00
retry if socket if flooded
This commit is contained in:
parent
182dc3a1c7
commit
6e4a349a9c
2 changed files with 9 additions and 10 deletions
7
makefile
7
makefile
|
@ -13,12 +13,7 @@ all: clean $(BINS)
|
|||
|
||||
install: clean $(BINS)
|
||||
ln ./bin/sketchybar /usr/local/bin/sketchybar
|
||||
mkdir ~/.config/sketchybar
|
||||
cp sketchybarrc ~/.config/sketchybar/sketchybarrc
|
||||
cp -r plugins ~/.config/sketchybar
|
||||
chmod +x ~/.config/sketchybar/sketchybarrc
|
||||
chmod +x ~/.config/sketchybar/plugins/*
|
||||
echo "Install complete..."
|
||||
echo "Install complete... Do not forget to setup the configuration file."
|
||||
|
||||
uninstall: clean
|
||||
rm /usr/local/bin/sketchybar
|
||||
|
|
|
@ -46,8 +46,10 @@ static int client_send_message(int argc, char **argv) {
|
|||
char socket_file[MAXLEN];
|
||||
snprintf(socket_file, sizeof(socket_file), SOCKET_PATH_FMT, user);
|
||||
|
||||
if (!socket_connect_un(&sockfd, socket_file)) {
|
||||
error("sketchybar-msg: failed to connect to socket..\n");
|
||||
int count = 0;
|
||||
while (!socket_connect_un(&sockfd, socket_file)) {
|
||||
count++;
|
||||
if (count > 100) error("sketchybar-msg: failed to connect to socket..\n");
|
||||
}
|
||||
|
||||
int message_length = argc;
|
||||
|
@ -68,8 +70,10 @@ static int client_send_message(int argc, char **argv) {
|
|||
}
|
||||
*temp++ = '\0';
|
||||
|
||||
if (!socket_write_bytes(sockfd, message, message_length)) {
|
||||
error("sketchybar-msg: failed to send data..\n");
|
||||
count = 0;
|
||||
while (!socket_write_bytes(sockfd, message, message_length)) {
|
||||
count++;
|
||||
if (count > 100) error("sketchybar-msg: failed to send data..\n");
|
||||
}
|
||||
|
||||
shutdown(sockfd, SHUT_WR);
|
||||
|
|
Loading…
Reference in a new issue